aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Update
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2020-12-17 13:27:11 +0100
committerMario <mario@mariovavti.com>2020-12-17 13:29:15 +0000
commit612448e4ae0a1595d698dff3dbbc442e94367c50 (patch)
tree310b5e652ab11745f71e0fbf4b473170dbb68236 /Zotlabs/Update
parent82db19d54caf374963e0c6fa5f7391b10caf9ba8 (diff)
downloadvolse-hubzilla-612448e4ae0a1595d698dff3dbbc442e94367c50.tar.gz
volse-hubzilla-612448e4ae0a1595d698dff3dbbc442e94367c50.tar.bz2
volse-hubzilla-612448e4ae0a1595d698dff3dbbc442e94367c50.zip
update to fix empty hubloc_id_url caused by clone import bug for zot hublocs which was fixed in 4693069a0618775167fd5c5b8c91b80f8a832da0
Diffstat (limited to 'Zotlabs/Update')
-rw-r--r--Zotlabs/Update/_1240.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/Zotlabs/Update/_1240.php b/Zotlabs/Update/_1240.php
new file mode 100644
index 000000000..d007c9fa9
--- /dev/null
+++ b/Zotlabs/Update/_1240.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1240 {
+
+ function run() {
+
+ q("START TRANSACTION");
+
+ // remove broken xchan entries
+ $r0 = dbq("DELETE FROM xchan WHERE xchan_hash = ''");
+
+ // remove broken hubloc entries
+ $r1 = dbq("DELETE FROM hubloc WHERE hubloc_hash = ''");
+
+ // fix legacy zot hubloc_id_url
+ $r2 = 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 = ''"
+ );
+
+ if($r0 && $r1 && $r2) {
+ q("COMMIT");
+ return UPDATE_SUCCESS;
+ }
+
+ q("ROLLBACK");
+ return UPDATE_FAILED;
+
+ }
+
+}