From 2a6d7b6a079a565afc0200fe160cb2402ed7c0a3 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 28 May 2014 21:42:46 -0700 Subject: cleanup dead directory entries. This was a real b#tch, so keep your eye out for issues - which you shouldn't see until next weekend when this is scheduled to run. We're only setting flags, so if anything goes wrong we should be able to recover without too much pain. --- mod/post.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'mod') diff --git a/mod/post.php b/mod/post.php index 1f817aa40..05053e798 100644 --- a/mod/post.php +++ b/mod/post.php @@ -646,6 +646,28 @@ function post_post(&$a) { intval($hub['hubloc_id']) ); + // a dead hub came back to life - reset any tombstones we might have + + if($hub['hubloc_status'] & HUBLOC_OFFLINE) { + q("update hubloc set hubloc_status = (hubloc_status ^ %d) where hubloc_id = %d limit 1", + intval(HUBLOC_OFFLINE), + intval($hub['hubloc_id']) + ); + if($r[0]['hubloc_flags'] & HUBLOC_FLAGS_ORPHANCHECK) { + q("update hubloc set hubloc_flags = (hubloc_flags ^ %d) where hubloc_id = %d limit 1", + intval(HUBLOC_FLAGS_ORPHANCHECK), + intval($hub['hubloc_id']) + ); + } + q("update xchan set xchan_flags = (xchan_flags ^ %d) where (xchan_flags & %d) and xchan_hash = '%s' limit 1", + intval(XCHAN_FLAGS_ORPHAN), + intval(XCHAN_FLAGS_ORPHAN), + dbesc($hub['hubloc_hash']) + ); + } + + + /** * This hub has now been proven to be valid. * Any hub with the same URL and a different sitekey cannot be valid. -- cgit v1.2.3