aboutsummaryrefslogtreecommitdiffstats
path: root/include/Contact.php
diff options
context:
space:
mode:
authorhabeascodice <habeascodice@federated.social>2014-11-01 03:04:11 -0700
committerhabeascodice <habeascodice@federated.social>2014-11-01 03:04:11 -0700
commit31376de0665091f2dba04755562ccd238d57a13c (patch)
treeae59c8697b9fd20c33aeaf8acb3a698b63e9657b /include/Contact.php
parentc854f8c238da2df08b52249142ad24ef66e422d1 (diff)
parent50c16c394fe2d966c62d30930600212a4e33303e (diff)
downloadvolse-hubzilla-31376de0665091f2dba04755562ccd238d57a13c.tar.gz
volse-hubzilla-31376de0665091f2dba04755562ccd238d57a13c.tar.bz2
volse-hubzilla-31376de0665091f2dba04755562ccd238d57a13c.zip
Merge remote branch 'upstream/master'
Diffstat (limited to 'include/Contact.php')
-rw-r--r--include/Contact.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 4440369dc..20e5e1a1e 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -245,11 +245,13 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
intval($channel_id)
);
+
$r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_hash = '%s'",
intval(HUBLOC_FLAGS_DELETED),
dbesc($channel['channel_hash'])
);
+
$r = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s'",
intval(XCHAN_FLAGS_DELETED),
dbesc($channel['channel_hash'])
@@ -257,7 +259,6 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
proc_run('php','include/notifier.php','purge_all',$channel_id);
-
}
q("DELETE FROM `groups` WHERE `uid` = %d", intval($channel_id));
@@ -291,11 +292,23 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
dbesc(z_root())
);
- $r = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s' ",
- intval(XCHAN_FLAGS_DELETED),
- dbesc($channel['channel_hash'])
+ // Do we have any valid hublocs remaining?
+
+ $hublocs = 0;
+
+ $r = q("select hubloc_id from hubloc where hubloc_hash = '%s' and not (hubloc_flags & %d)",
+ dbesc($channel['channel_hash']),
+ intval(HUBLOC_FLAGS_DELETED)
);
+ if($r)
+ $hublocs = count($r);
+ if(! $hublocs) {
+ $r = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s' ",
+ intval(XCHAN_FLAGS_DELETED),
+ dbesc($channel['channel_hash'])
+ );
+ }
proc_run('php','include/directory.php',$channel_id);