aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-09-23 11:44:10 +0000
committerMario <mario@mariovavti.com>2020-09-23 14:15:47 +0200
commit987a369fec11107294a5563a7172e80cb611423d (patch)
tree0fb64d270a55f8148bf5d5f8bc35c389ddd9471c
parent586e2ef2df08efca37cea28f6c4d04b01e108a85 (diff)
downloadvolse-hubzilla-987a369fec11107294a5563a7172e80cb611423d.tar.gz
volse-hubzilla-987a369fec11107294a5563a7172e80cb611423d.tar.bz2
volse-hubzilla-987a369fec11107294a5563a7172e80cb611423d.zip
5.0RC testing: update hublocs by hubloc_id_url of we mark it deleted or change primary to catch both zot and zot6 hublocs. only set the zot6 hubloc as primary.
(cherry picked from commit 6f508b81d62f9fec91840d4b7a35eaa5209bdeca)
-rw-r--r--Zotlabs/Lib/Libsync.php16
-rw-r--r--Zotlabs/Module/Locs.php16
2 files changed, 17 insertions, 15 deletions
diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php
index b7cda1770..b16080a51 100644
--- a/Zotlabs/Lib/Libsync.php
+++ b/Zotlabs/Lib/Libsync.php
@@ -819,9 +819,9 @@ class Libsync {
}
if(intval($r[0]['hubloc_primary']) && (! $location['primary'])) {
- $m = q("update hubloc set hubloc_primary = 0, hubloc_updated = '%s' where hubloc_id = %d",
+ $m = q("update hubloc set hubloc_primary = 0, hubloc_updated = '%s' where hubloc_id_url = '%s'",
dbesc(datetime_convert()),
- intval($r[0]['hubloc_id'])
+ intval($r[0]['hubloc_id_url'])
);
$r[0]['hubloc_primary'] = intval($location['primary']);
hubloc_change_primary($r[0]);
@@ -848,18 +848,18 @@ class Libsync {
}
}
if(intval($r[0]['hubloc_deleted']) && (! intval($location['deleted']))) {
- $n = q("update hubloc set hubloc_deleted = 0, hubloc_updated = '%s' where hubloc_id = %d",
+ $n = q("update hubloc set hubloc_deleted = 0, hubloc_updated = '%s' where hubloc_id_url = '%s'",
dbesc(datetime_convert()),
- intval($r[0]['hubloc_id'])
+ dbesc($r[0]['hubloc_id_url'])
);
$what .= 'undelete_hub ';
$changed = true;
}
elseif((! intval($r[0]['hubloc_deleted'])) && (intval($location['deleted']))) {
logger('deleting hubloc: ' . $r[0]['hubloc_addr']);
- $n = q("update hubloc set hubloc_deleted = 1, hubloc_updated = '%s' where hubloc_id = %d",
+ $n = q("update hubloc set hubloc_deleted = 1, hubloc_updated = '%s' where hubloc_id_url = '%s'",
dbesc(datetime_convert()),
- intval($r[0]['hubloc_id'])
+ dbesc($r[0]['hubloc_id_url'])
);
$what .= 'delete_hub ';
$changed = true;
@@ -918,9 +918,9 @@ class Libsync {
foreach($xisting as $x) {
if(! array_key_exists('updated',$x)) {
logger('Deleting unreferenced hub location ' . $x['hubloc_addr']);
- $r = q("update hubloc set hubloc_deleted = 1, hubloc_updated = '%s' where hubloc_id = %d",
+ $r = q("update hubloc set hubloc_deleted = 1, hubloc_updated = '%s' where hubloc_id_url = '%s'",
dbesc(datetime_convert()),
- intval($x['hubloc_id'])
+ dbesc($x['hubloc_id_url'])
);
$what .= 'removed_hub ';
$changed = true;
diff --git a/Zotlabs/Module/Locs.php b/Zotlabs/Module/Locs.php
index 63ca763a9..4c935a6a2 100644
--- a/Zotlabs/Module/Locs.php
+++ b/Zotlabs/Module/Locs.php
@@ -18,7 +18,7 @@ class Locs extends Controller {
$hubloc_id = intval($_REQUEST['primary']);
if($hubloc_id) {
- $r = q("select hubloc_id from hubloc where hubloc_id = %d and hubloc_hash = '%s' limit 1",
+ $r = q("select * from hubloc where hubloc_id = %d and hubloc_hash = '%s' limit 1",
intval($hubloc_id),
dbesc($channel['channel_hash'])
);
@@ -28,10 +28,11 @@ class Locs extends Controller {
return;
}
- $r = q("update hubloc set hubloc_primary = 0 where hubloc_primary = 1 and hubloc_hash = '%s' ",
- dbesc($channel['channel_hash'])
+ q("UPDATE hubloc SET hubloc_primary = 0 WHERE hubloc_primary = 1 AND (hubloc_hash = '%s' OR hubloc_hash = '%s')",
+ dbesc($channel['channel_hash']),
+ dbesc($channel['channel_portable_id'])
);
- $r = q("update hubloc set hubloc_primary = 1 where hubloc_id = %d and hubloc_hash = '%s'",
+ q("UPDATE hubloc SET hubloc_primary = 1 WHERE hubloc_id = %d AND hubloc_hash = '%s'",
intval($hubloc_id),
dbesc($channel['channel_hash'])
);
@@ -70,9 +71,10 @@ class Locs extends Controller {
}
}
- $r = q("update hubloc set hubloc_deleted = 1 where hubloc_id = %d and hubloc_hash = '%s'",
- intval($hubloc_id),
- dbesc($channel['channel_hash'])
+ q("UPDATE hubloc SET hubloc_deleted = 1 WHERE hubloc_id_url = '%s' AND (hubloc_hash = '%s' OR hubloc_hash = '%s')",
+ dbesc($r[0]['hubloc_id_url']),
+ dbesc($channel['channel_hash']),
+ dbesc($channel['channel_portable_id'])
);
Master::Summon( [ 'Notifier', 'refresh_all', $channel['channel_id'] ] );
return;