aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/channel.php1
-rw-r--r--include/connections.php54
2 files changed, 27 insertions, 28 deletions
diff --git a/include/channel.php b/include/channel.php
index c36e50f19..bb213f102 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -2855,7 +2855,6 @@ function channel_remove($channel_id, $local = true, $unset_session = false) {
q("DELETE FROM app WHERE app_channel = %d", intval($channel_id));
q("DELETE FROM atoken WHERE atoken_uid = %d", intval($channel_id));
q("DELETE FROM chatroom WHERE cr_uid = %d", intval($channel_id));
- q("DELETE FROM conv WHERE uid = %d", intval($channel_id));
q("DELETE FROM pgrp WHERE uid = %d", intval($channel_id));
q("DELETE FROM pgrp_member WHERE uid = %d", intval($channel_id));
diff --git a/include/connections.php b/include/connections.php
index 2a186192d..e8415bb25 100644
--- a/include/connections.php
+++ b/include/connections.php
@@ -270,8 +270,6 @@ function mark_orphan_hubsxchans() {
}
-
-
function remove_all_xchan_resources($xchan, $channel_id = 0) {
if(!$xchan)
@@ -279,18 +277,27 @@ function remove_all_xchan_resources($xchan, $channel_id = 0) {
if(intval($channel_id)) {
-
+ // reserved for future use
}
else {
- $dirmode = intval(get_config('system','directory_mode'));
+ // This function is only to be executed on remote servers where only the xchan exists
+ // and there is no associated channel.
+
+ $c = q("select channel_id from channel where channel_hash = '%s'",
+ dbesc($xchan)
+ );
+
+ if ($c) {
+ return;
+ }
$r = q("delete from photo where xchan = '%s'",
dbesc($xchan)
);
- $r = q("select resource_id, resource_type, uid, id from item where ( author_xchan = '%s' or owner_xchan = '%s' ) ",
+ $r = q("select id from item where ( author_xchan = '%s' or owner_xchan = '%s' ) ",
dbesc($xchan),
dbesc($xchan)
);
@@ -309,37 +316,30 @@ function remove_all_xchan_resources($xchan, $channel_id = 0) {
dbesc($xchan)
);
- $r = q("delete from xlink where ( xlink_xchan = '%s' or xlink_link = '%s' )",
- dbesc($xchan),
+ $r = q("delete from abook where abook_xchan = '%s'",
dbesc($xchan)
);
- $r = q("delete from abook where abook_xchan = '%s'",
+ $r = q("delete from abconfig where xchan = '%s'",
dbesc($xchan)
);
- if($dirmode === false || $dirmode == DIRECTORY_MODE_NORMAL) {
-
- $r = q("delete from xchan where xchan_hash = '%s'",
- dbesc($xchan)
- );
- $r = q("delete from hubloc where hubloc_hash = '%s'",
- dbesc($xchan)
- );
-
- }
- else {
+ $r = q("delete from xlink where (xlink_xchan = '%s' or xlink_link = '%s')",
+ dbesc($xchan),
+ dbesc($xchan)
+ );
- // directory servers need to keep the record around for sync purposes - mark it deleted
+ $r = q("delete from xprof where xprof_hash = '%s'",
+ dbesc($xchan)
+ );
- $r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s'",
- dbesc($xchan)
- );
+ $r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s'",
+ dbesc($xchan)
+ );
- $r = q("update xchan set xchan_deleted = 1 where xchan_hash = '%s'",
- dbesc($xchan)
- );
- }
+ $r = q("update xchan set xchan_deleted = 1 where xchan_hash = '%s'",
+ dbesc($xchan)
+ );
}
}