aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-12-16 00:25:41 -0800
committerfriendica <info@friendica.com>2014-12-16 00:25:41 -0800
commit17e27d0d87d1197bd2928030ad98cd19869f78d4 (patch)
tree71e63acca364838d8320d763d8292ba38aaa23eb /include
parent2e990743e757bea6712a3f3e9639a43c89b52901 (diff)
downloadvolse-hubzilla-17e27d0d87d1197bd2928030ad98cd19869f78d4.tar.gz
volse-hubzilla-17e27d0d87d1197bd2928030ad98cd19869f78d4.tar.bz2
volse-hubzilla-17e27d0d87d1197bd2928030ad98cd19869f78d4.zip
add Thomas's Diaspora repair script as include/fixd.php - altered so it can be re-run if necessary with a count of remaining hublocs to be fixed. Some sites are down so it probably can't ever get to zero. The check for a null join is quite an expensive query. It could block your DB for a couple minutes while it runs.
Also some preliminary work on a means to take the channel module out of list/forum mode if a specific mid is requested.
Diffstat (limited to 'include')
-rw-r--r--include/fixd.php33
-rw-r--r--include/network.php24
2 files changed, 46 insertions, 11 deletions
diff --git a/include/fixd.php b/include/fixd.php
new file mode 100644
index 000000000..bce5eb348
--- /dev/null
+++ b/include/fixd.php
@@ -0,0 +1,33 @@
+<?php
+
+ require_once('include/cli_startup.php');
+
+ cli_startup();
+
+ $rand = db_getfunc('RAND');
+ $r = q("select xchan_addr, hubloc_url from xchan left join hubloc on hubloc_hash = xchan_hash where xchan_network like '%%diaspora%%' order by $rand");
+
+ if(! $r)
+ killme();
+
+ require_once('include/network.php');
+ $total = 0;
+ foreach ($r as $rr) {
+ if($rr['hubloc_url']) {
+ continue;
+ }
+ $total ++;
+ }
+
+ print $total . "\n";
+
+ foreach ($r as $rr) {
+ if($rr['hubloc_url']) {
+ continue;
+ }
+
+ $webbie = $rr['xchan_addr'];
+ print $webbie . ' ';
+
+ discover_by_webbie($webbie);
+ }
diff --git a/include/network.php b/include/network.php
index 15e605673..98c411cd8 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1094,23 +1094,25 @@ function discover_by_webbie($webbie) {
);
if(! $r) {
- $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_pubkey, xchan_addr, xchan_url, xchan_name, xchan_network, xchan_instance_url, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ",
- dbesc($addr),
- dbesc($guid),
- dbesc($pubkey),
- dbesc($addr),
- dbesc($profile),
- dbesc($vcard['fn']),
- dbesc($network),
- dbesc(z_root()),
- dbescdate(datetime_convert())
- );
+ $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_pubkey, xchan_addr, xchan_url, xchan_name, xchan_network, xchan_instance_url, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') ",
+ dbesc($addr),
+ dbesc($guid),
+ dbesc($pubkey),
+ dbesc($addr),
+ dbesc($profile),
+ dbesc($vcard['fn']),
+ dbesc($network),
+ dbesc(z_root()),
+ dbescdate(datetime_convert())
+ );
}
$r = q("select * from hubloc where hubloc_hash = '%s' limit 1",
dbesc($webbie)
);
+
if(! $r) {
+
$r = q("insert into hubloc ( hubloc_guid, hubloc_hash, hubloc_addr, hubloc_network, hubloc_url, hubloc_host, hubloc_callback, hubloc_updated, hubloc_flags ) values ('%s','%s','%s','%s','%s','%s','%s','%s', %d)",
dbesc($guid),
dbesc($addr),