diff options
author | Mario <mario@mariovavti.com> | 2021-05-05 08:50:03 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-05-05 08:50:03 +0000 |
commit | 83fbb0678c5cdb8d76cddecd39df490e092f47ad (patch) | |
tree | fa1ec22c193dba9871a9c3c1cbe28470539e2166 /include/hubloc.php | |
parent | df3778c64f375ea22913f147382ee5daa67bd7bb (diff) | |
download | volse-hubzilla-83fbb0678c5cdb8d76cddecd39df490e092f47ad.tar.gz volse-hubzilla-83fbb0678c5cdb8d76cddecd39df490e092f47ad.tar.bz2 volse-hubzilla-83fbb0678c5cdb8d76cddecd39df490e092f47ad.zip |
use hubloc_hash instead of hubloc_id_url - otherwise it will bite hublocs which use more than one protocol
Diffstat (limited to 'include/hubloc.php')
-rw-r--r-- | include/hubloc.php | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/include/hubloc.php b/include/hubloc.php index 7af4e471b..94d1af5f0 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -179,36 +179,29 @@ function remove_obsolete_hublocs() { * */ function remove_duplicate_singleton_hublocs() { - $hublocs = dbq("SELECT - hubloc_id_url, - COUNT(hubloc_id_url) - FROM - hubloc - WHERE - hubloc_network IN ( + $hublocs = dbq("SELECT hubloc_hash, COUNT(hubloc_hash) FROM hubloc WHERE + hubloc_network IN( 'activitypub', 'diaspora', 'friendica-over-diaspora', 'gnusoc' ) - GROUP BY - hubloc_id_url - HAVING - COUNT(hubloc_id_url) > 1" + GROUP BY hubloc_hash + HAVING COUNT(hubloc_hash) > 1" ); foreach($hublocs as $hubloc) { - $hubloc_id_url = $hubloc['hubloc_id_url']; + $hubloc_hash = $hubloc['hubloc_hash']; - $max_id = q("select max(hubloc_id) as max_id from hubloc where hubloc_id_url = '%s'", - dbesc($hubloc_id_url) + $max_id = q("select max(hubloc_id) as max_id from hubloc where hubloc_hash = '%s'", + dbesc($hubloc_hash) ); $id = $max_id[0]['max_id']; - if($hubloc_id_url && $id) { - q("delete from hubloc where hubloc_id_url = '%s' and hubloc_id != %d", - dbesc($hubloc_id_url), + if($hubloc_hash && $id) { + q("delete from hubloc where hubloc_hash = '%s' and hubloc_id != %d", + dbesc($hubloc_hash), intval($id) ); } |