aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-24 18:55:07 -0700
committerfriendica <info@friendica.com>2013-08-24 18:55:07 -0700
commit1c17d1b69c2b3db9f9c3ffd0dee4ca9ea57af05a (patch)
treeb7312c1e8103822ba1655f4145ba5a91d8dedef6
parent4925f7fc53e5971541e1fcfcbd38597a7536a2e8 (diff)
downloadvolse-hubzilla-1c17d1b69c2b3db9f9c3ffd0dee4ca9ea57af05a.tar.gz
volse-hubzilla-1c17d1b69c2b3db9f9c3ffd0dee4ca9ea57af05a.tar.bz2
volse-hubzilla-1c17d1b69c2b3db9f9c3ffd0dee4ca9ea57af05a.zip
start timestamping hubloc connections so we can eventually remove dead ones
-rwxr-xr-xboot.php7
-rw-r--r--mod/post.php12
2 files changed, 16 insertions, 3 deletions
diff --git a/boot.php b/boot.php
index c0911cc19..f27410d3e 100755
--- a/boot.php
+++ b/boot.php
@@ -1284,7 +1284,7 @@ function fix_system_urls($oldurl,$newurl) {
// that they can clean up their hubloc tables (this includes directories).
// It's a very expensive operation so you don't want to have to do it often or after your site gets to be large.
- $r = q("select * from xchan left join channel on channel_hash = xchan_hash where xchan_url like '%s'",
+ $r = q("select xchan.*, channel.* from xchan left join channel on channel_hash = xchan_hash where xchan_url like '%s'",
dbesc($oldurl . '%')
);
if($r) {
@@ -1317,7 +1317,10 @@ function fix_system_urls($oldurl,$newurl) {
dbesc($newurl . '/post'),
dbesc($rr['xchan_hash']),
dbesc($oldurl)
- );
+ );
+
+ proc_run('php', 'include/notifier.php', 'refresh_all', $rr['channel_id']);
+
}
}
}
diff --git a/mod/post.php b/mod/post.php
index 07f2cd083..847af0fe9 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -297,13 +297,23 @@ function post_post(&$a) {
// (!!) this will validate the sender
$result = zot_register_hub($sender);
- if((! $result['success']) || (! zot_gethub($sender))) {
+ if((! $result['success']) || (! ($hub = zot_gethub($sender)))) {
$ret['message'] = 'Hub not available.';
logger('mod_zot: no hub');
json_return_and_die($ret);
}
}
+
+ // Update our DB to show when we last communicated successfully with this hub
+ // This will allow us to prune dead hubs from using up resources
+
+ $r = q("update hubloc set hubloc_connected = '%s' where hubloc_id = %d limit 1",
+ dbesc(datetime_convert()),
+ intval($hub['hubloc_id'])
+ );
+
+
// TODO: check which hub is primary and take action if mismatched
if(array_key_exists('recipients',$data))