make hubloc repair script a bit more selective

This commit is contained in:
redmatrix 2015-10-31 13:58:26 -07:00
parent 7a87343c71
commit 04820ba09e
2 changed files with 14 additions and 4 deletions

View File

@ -13,15 +13,25 @@ function fhublocs_content(&$a) {
$o = ''; $o = '';
$r = q("select * from channel where channel_removed = 0"); $r = q("select * from channel where channel_removed = 0");
$sitekey = get_config('system','pubkey');
if($r) { if($r) {
foreach($r as $rr) { foreach($r as $rr) {
$found = false;
$primary_address = ''; $primary_address = '';
$x = zot_get_hublocs($rr['channel_hash']); $x = zot_get_hublocs($rr['channel_hash']);
if($x) { if($x) {
foreach($x as $xx) {
if($xx['hubloc_url'] === z_root() && $xx['hubloc_sitekey'] === $sitekey) {
$found = true;
break;
}
}
if($found) {
$o .= 'Hubloc exists for ' . $rr['channel_name'] . EOL; $o .= 'Hubloc exists for ' . $rr['channel_name'] . EOL;
continue; continue;
} }
}
$y = q("select xchan_addr from xchan where xchan_hash = '%s' limit 1", $y = q("select xchan_addr from xchan where xchan_hash = '%s' limit 1",
dbesc($rr['channel_hash']) dbesc($rr['channel_hash'])
); );
@ -53,7 +63,7 @@ function fhublocs_content(&$a) {
dbesc(base64url_encode(rsa_sign(z_root(),$rr['channel_prvkey']))), dbesc(base64url_encode(rsa_sign(z_root(),$rr['channel_prvkey']))),
dbesc(get_app()->get_hostname()), dbesc(get_app()->get_hostname()),
dbesc(z_root() . '/post'), dbesc(z_root() . '/post'),
dbesc(get_config('system','pubkey')), dbesc($sitekey),
dbesc('zot') dbesc('zot')
); );

View File

@ -1 +1 @@
2015-10-30.1201 2015-10-31.1202