aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-07-26 07:45:20 +0000
committerMario <mario@mariovavti.com>2020-07-26 07:45:20 +0000
commit33e4d7c0d8b3f7b4088a1b02c3519b626a07daae (patch)
tree5ab7482579eaa6c466975587b9551f2ad62141aa
parentad308341237e92f70da09d91047cb0ccecf02ecf (diff)
downloadvolse-hubzilla-33e4d7c0d8b3f7b4088a1b02c3519b626a07daae.tar.gz
volse-hubzilla-33e4d7c0d8b3f7b4088a1b02c3519b626a07daae.tar.bz2
volse-hubzilla-33e4d7c0d8b3f7b4088a1b02c3519b626a07daae.zip
fix hubloc_id_url for activitypub with broken xchan_url
-rw-r--r--Zotlabs/Module/Fhubloc_id_url.php29
-rw-r--r--Zotlabs/Update/_1238.php28
2 files changed, 44 insertions, 13 deletions
diff --git a/Zotlabs/Module/Fhubloc_id_url.php b/Zotlabs/Module/Fhubloc_id_url.php
index f384d9d8d..a03f3f1b6 100644
--- a/Zotlabs/Module/Fhubloc_id_url.php
+++ b/Zotlabs/Module/Fhubloc_id_url.php
@@ -19,23 +19,40 @@ class Fhubloc_id_url extends \Zotlabs\Web\Controller {
// fix singleton networks hubloc_id_url
if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
- $r2 = dbq("UPDATE hubloc
+ // fix entries for activitypub which miss the xchan_url due to an earlier bug
+ $r2 = dbq("UPDATE xchan
+ SET xchan_url = xchan_hash
+ WHERE xchan_network = 'activitypub'
+ AND xchan_url = ''
+ AND xchan_hash != ''"
+ );
+
+ $r3 = 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 != ''"
+ AND hubloc_id_url = ''"
);
+
}
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r2 = dbq("UPDATE hubloc
+ // fix entries for activitypub which miss the xchan_url due to an earlier bug
+ $r2 = dbq("UPDATE xchan
+ SET xchan_url = xchan_hash
+ WHERE xchan_network = 'activitypub'
+ AND xchan_url = ''
+ AND xchan_hash != ''"
+ );
+
+ $r3 = 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 != ''"
+ AND hubloc_id_url = ''"
);
+
+
}
}
}
diff --git a/Zotlabs/Update/_1238.php b/Zotlabs/Update/_1238.php
index 77a14c3fa..0e25c36bb 100644
--- a/Zotlabs/Update/_1238.php
+++ b/Zotlabs/Update/_1238.php
@@ -21,26 +21,40 @@ class _1238 {
// fix singleton networks hubloc_id_url
if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
- $r2 = dbq("UPDATE hubloc
+ // fix entries for activitypub which miss the xchan_url due to an earlier bug
+ $r2 = dbq("UPDATE xchan
+ SET xchan_url = xchan_hash
+ WHERE xchan_network = 'activitypub'
+ AND xchan_url = ''
+ AND xchan_hash != ''"
+ );
+
+ $r3 = 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 != ''"
+ AND hubloc_id_url = ''"
);
}
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r2 = dbq("UPDATE hubloc
+ // fix entries for activitypub which miss the xchan_url due to an earlier bug
+ $r2 = dbq("UPDATE xchan
+ SET xchan_url = xchan_hash
+ WHERE xchan_network = 'activitypub'
+ AND xchan_url = ''
+ AND xchan_hash != ''"
+ );
+
+ $r3 = 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 != ''"
+ AND hubloc_id_url = ''"
);
}
- if($r1 && $r2) {
+ if($r1 && $r2 && $r3) {
q("COMMIT");
return UPDATE_SUCCESS;
}