diff options
author | Mario <mario@mariovavti.com> | 2020-07-24 20:46:55 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-07-24 20:46:55 +0000 |
commit | 9b5e270379bc2301f3edde2290525e3b546fa049 (patch) | |
tree | a9a2787e75721f053fdb20534f65a9156c153199 /Zotlabs | |
parent | ea5131db88f0be0bba976f19d645d9a59bc3dccd (diff) | |
download | volse-hubzilla-9b5e270379bc2301f3edde2290525e3b546fa049.tar.gz volse-hubzilla-9b5e270379bc2301f3edde2290525e3b546fa049.tar.bz2 volse-hubzilla-9b5e270379bc2301f3edde2290525e3b546fa049.zip |
tool to fix missing hubloc_id_url entries
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Module/Fhubloc_id_url.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Zotlabs/Module/Fhubloc_id_url.php b/Zotlabs/Module/Fhubloc_id_url.php new file mode 100644 index 000000000..f384d9d8d --- /dev/null +++ b/Zotlabs/Module/Fhubloc_id_url.php @@ -0,0 +1,41 @@ +<?php +namespace Zotlabs\Module; + +/* fix missing or hubloc_id_url entries */ + +class Fhubloc_id_url extends \Zotlabs\Web\Controller { + + function get() { + + if(! is_site_admin()) + return; + + // fix legacy zot hubloc_id_url + $r1 = dbq("UPDATE hubloc + SET hubloc_id_url = CONCAT(hubloc_url, '/channel/', SUBSTRING(hubloc_addr FROM 1 FOR POSITION('@' IN hubloc_addr) -1)) + WHERE hubloc_network = 'zot' + AND hubloc_id_url = ''" + ); + + // fix singleton networks hubloc_id_url + if(ACTIVE_DBTYPE == DBTYPE_MYSQL) { + $r2 = dbq("UPDATE hubloc + LEFT JOIN xchan ON hubloc_hash = xchan_hash + SET hubloc_id_url = xchan_url + WHERE hubloc_network IN ('activitypub', 'diaspora', 'friendica-over-diaspora', 'gnusoc') + AND hubloc_id_url = '' + AND xchan_url != ''" + ); + } + if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + $r2 = dbq("UPDATE hubloc + SET hubloc_id_url = xchan_url + FROM xchan + WHERE hubloc_hash = xchan_hash + AND hubloc_network IN ('activitypub', 'diaspora', 'friendica-over-diaspora', 'gnusoc') + AND hubloc_id_url = '' + AND xchan_url != ''" + ); + } + } +} |