aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2023-04-13 22:28:08 +0200
committerMario Vavti <mario@mariovavti.com>2023-04-13 22:28:08 +0200
commit20f4538db4fdfe74c060670caf46a754f856313e (patch)
tree53bc39f35ea24f4ba998f1f8f75b0aa347ac4089
parentd08c8e6edc81448cb00564767fa1401b48059461 (diff)
downloadvolse-hubzilla-20f4538db4fdfe74c060670caf46a754f856313e.tar.gz
volse-hubzilla-20f4538db4fdfe74c060670caf46a754f856313e.tar.bz2
volse-hubzilla-20f4538db4fdfe74c060670caf46a754f856313e.zip
update remove_all_xchan_resources() and remove deletion of deprecated conv table
-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)
+ );
}
}