From e270bd3874bb4526138cc06cd26e2a1153778894 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 29 Jan 2013 19:28:19 -0800 Subject: mark for death implemented --- include/poller.php | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 00e336453..ef4b93fe7 100644 --- a/include/poller.php +++ b/include/poller.php @@ -124,9 +124,50 @@ function poller_run($argv, $argc){ $update = false; $t = $contact['abook_updated']; + $c = $contact['abook_connected']; - if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) - $update = true; + + if($c == $t) { + if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) + $update = true; + } + else { + // if we've never connected with them, start the mark for death countdown from now + + if($c === '0000-00-00 00:00:00') { + $r = q("update abook set abook_connected = '%s' where abook_id = %d limit 1", + dbesc(datetime_convert()), + intval($abook['abook_id']) + ); + $c = datetime_convert(); + $update = true; + } + + // He's dead, Jim + + if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $c . " + 30 day")) { + $r = q("update abook set abook_flags = (abook_flags & %d) where abook_id = %d limit 1", + intval(ABOOK_FLAG_ARCHIVED), + intval($contact['abook_id']) + ); + $update = false; + continue; + } + + // might be dead, so maybe don't poll quite so often + + // recently deceased, so keep up the regular schedule for 3 days + + if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $c . " + 3 day")) + && (datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day"))) + $update = true; + + // After that back off and put them on a morphine drip + + if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 2 day")) { + $update = true; + } + } if((! $update) && (! $force)) continue; -- cgit v1.2.3 From ea3940c4b0b8232e2de0771811b9f90ade9ee45f Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 25 Feb 2013 17:09:40 -0800 Subject: start formatting for Doxygen --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index ef4b93fe7..6f4736855 100644 --- a/include/poller.php +++ b/include/poller.php @@ -1,4 +1,4 @@ - Date: Mon, 25 Mar 2013 21:32:12 -0700 Subject: doco --- include/poller.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 6f4736855..1dd065196 100644 --- a/include/poller.php +++ b/include/poller.php @@ -30,8 +30,8 @@ function poller_run($argv, $argc){ // expire any expired accounts q("UPDATE account - SET account_flags = account_flags | %d - where not account_flags & %d + SET account_flags = (account_flags | %d) + where not (account_flags & %d) and account_expires != '0000-00-00 00:00:00' and account_expires < UTC_TIMESTAMP() ", intval(ACCOUNT_EXPIRED), @@ -56,6 +56,10 @@ function poller_run($argv, $argc){ proc_run('php','include/expire.php'); } + // If this is a directory server, request a sync with an upstream + // directory at least once a day, up to once every poll interval. + // Pull remote changes and push local changes. + // potential issue: how do we keep from creating an endless update loop? $manual_id = 0; $generation = 0; -- cgit v1.2.3 From 0fbb3b6a97e51fbfc02e56f3651d4bf9fdd0575c Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 18 Apr 2013 20:47:35 -0700 Subject: for directory sync, ensure we have a fallback master; even if we have nothing else --- include/poller.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 1dd065196..33e882735 100644 --- a/include/poller.php +++ b/include/poller.php @@ -50,16 +50,23 @@ function poller_run($argv, $argc){ if($d2 != intval($d1)) { + // If this is a directory server, request a sync with an upstream + // directory at least once a day, up to once every poll interval. + // Pull remote changes and push local changes. + // potential issue: how do we keep from creating an endless update loop? + + $dirmode = get_config('system','directory_mode'); + if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) { + require_once('include/dir_fns.php'); + sync_directories($dirmode); + } + // update_suggestions(); set_config('system','last_expire_day',$d2); proc_run('php','include/expire.php'); } - // If this is a directory server, request a sync with an upstream - // directory at least once a day, up to once every poll interval. - // Pull remote changes and push local changes. - // potential issue: how do we keep from creating an endless update loop? $manual_id = 0; $generation = 0; -- cgit v1.2.3 From c721c3a20e17783835672365ce56fe64876002c7 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 23 May 2013 17:24:15 -0700 Subject: implement time travelling posts --- include/poller.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 33e882735..43c7b497b 100644 --- a/include/poller.php +++ b/include/poller.php @@ -38,6 +38,16 @@ function poller_run($argv, $argc){ intval(ACCOUNT_EXPIRED) ); + // publish any applicable items that were set to be published in the future + // (time travel posts) + + q("update item set item_restrict = ( item_restrict ^ %d ) + where ( item_restrict & %d ) and created <= UTC_TIMESTAMP() ", + intval(ITEM_DELAYED_PUBLISH), + intval(ITEM_DELAYED_PUBLISH) + ); + + $abandon_days = intval(get_config('system','account_abandon_days')); if($abandon_days < 1) $abandon_days = 0; -- cgit v1.2.3 From df32c93d562f0dfcc28ebf36723ef07dab630b90 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 27 May 2013 05:27:35 -0700 Subject: zidify img links, delay notifier until actually published for time travelling posts --- include/poller.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 43c7b497b..433bc8caf 100644 --- a/include/poller.php +++ b/include/poller.php @@ -41,12 +41,20 @@ function poller_run($argv, $argc){ // publish any applicable items that were set to be published in the future // (time travel posts) - q("update item set item_restrict = ( item_restrict ^ %d ) - where ( item_restrict & %d ) and created <= UTC_TIMESTAMP() ", - intval(ITEM_DELAYED_PUBLISH), + $r = q("select id from item where ( item_restrict & %d ) and created <= UTC_TIMESTAMP() ", intval(ITEM_DELAYED_PUBLISH) ); - + if($r) { + foreach($r as $rr) { + $x = q("update item set item_restrict = ( item_restrict ^ %d ) where id = %d limit 1", + intval(ITEM_DELAYED_PUBLISH), + intval($rr['id']) + ); + if($x) { + proc_run('php','include/notifer.php','wall-new',$rr['id']); + } + } + } $abandon_days = intval(get_config('system','account_abandon_days')); if($abandon_days < 1) -- cgit v1.2.3 From 21491100f834372545569035e525ab74fc64cf26 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 3 Jun 2013 22:34:35 -0700 Subject: fix buggered contact photos --- include/poller.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 433bc8caf..c076d30f7 100644 --- a/include/poller.php +++ b/include/poller.php @@ -85,6 +85,26 @@ function poller_run($argv, $argc){ proc_run('php','include/expire.php'); } + // update any photos which didn't get imported properly + // This should be rare + + $r = q("select xchan_photo_l, xchan_hash from xchan where xchan_photo_l != '' and xchan_photo_m = '' + and xchan_photo_date < GMT_TIMESTAMP() - INTERVAL 1 DAY"); + if($r) { + require_once('include/photo/photo_driver.php'); + foreach($r as $rr) { + $photos = import_profile_photo($rr['xchan_photo_l'],$rr['xchan_hash']); + $x = q("update xchan set xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' + where xchan_hash = '%s' limit 1", + dbesc($photos[0]), + dbesc($photos[1]), + dbesc($photos[2]), + dbesc($photos[3]), + dbesc($rr['xchan_hash']) + ); + } + } + $manual_id = 0; $generation = 0; -- cgit v1.2.3 From 1b70ac1bc03e01d080ffcd646ca2b6c44b5b9454 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 6 Jun 2013 16:12:34 -0700 Subject: no GMT_TIMESTAMP() in mysql - use UTC_TIMESTAMP() instead --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index c076d30f7..dff16d3d7 100644 --- a/include/poller.php +++ b/include/poller.php @@ -89,7 +89,7 @@ function poller_run($argv, $argc){ // This should be rare $r = q("select xchan_photo_l, xchan_hash from xchan where xchan_photo_l != '' and xchan_photo_m = '' - and xchan_photo_date < GMT_TIMESTAMP() - INTERVAL 1 DAY"); + and xchan_photo_date < UTC_TIMESTAMP() - INTERVAL 1 DAY"); if($r) { require_once('include/photo/photo_driver.php'); foreach($r as $rr) { -- cgit v1.2.3 From 72f6edd59507797ef4073aed01ca1a0d14fa8cfd Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 30 Jun 2013 00:38:02 -0700 Subject: add age to directory profile - requires updating on each birthday and that part is still missing --- include/poller.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index dff16d3d7..f50bd4e3e 100644 --- a/include/poller.php +++ b/include/poller.php @@ -63,6 +63,9 @@ function poller_run($argv, $argc){ // once daily run birthday_updates and then expire in background + // FIXME: add birthday updates, both locally and for xprof for use + // by directory servers + $d1 = get_config('system','last_expire_day'); $d2 = intval(datetime_convert('UTC','UTC','now','d')); -- cgit v1.2.3 From c2f97f7490cd96e92432ca6c397dce2f6ab80eaa Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 5 Aug 2013 20:08:35 -0700 Subject: populate initial suggestions (ultimately we want to do this at install time as well as from the poller so that new sites have friend suggestions when they create their first channel). --- include/poller.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index f50bd4e3e..00914a712 100644 --- a/include/poller.php +++ b/include/poller.php @@ -82,10 +82,12 @@ function poller_run($argv, $argc){ sync_directories($dirmode); } -// update_suggestions(); set_config('system','last_expire_day',$d2); proc_run('php','include/expire.php'); + + proc_run('php','include/cli_suggest.php'); + } // update any photos which didn't get imported properly -- cgit v1.2.3 From ac541a7d3246e1c5c60ae752326c1b9ba5ccd78f Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 14 Aug 2013 20:09:02 -0700 Subject: most of expire is now ported from friendica, but the protocol bits to push out the delete notifications for the entire batch to all recipients of the original post are not complete and will take quite a bit more work. As a consequence, expire has been completely disabled until it is fully implmented since it could result in completely un-removable posts reminiscent of the infamous "Bonnie Nadri" incident at Diaspora which we do not wish to re-live. --- include/poller.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 00914a712..7f76750b4 100644 --- a/include/poller.php +++ b/include/poller.php @@ -84,7 +84,8 @@ function poller_run($argv, $argc){ set_config('system','last_expire_day',$d2); - proc_run('php','include/expire.php'); +// Uncomment when expire protocol component is working +// proc_run('php','include/expire.php'); proc_run('php','include/cli_suggest.php'); -- cgit v1.2.3 From d46436dc9c115d29a18a29203bd12d3246472365 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 15 Aug 2013 17:36:00 -0700 Subject: issues marking for death --- include/poller.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 7f76750b4..7a6aaeb22 100644 --- a/include/poller.php +++ b/include/poller.php @@ -118,18 +118,18 @@ function poller_run($argv, $argc){ $force = false; $restart = false; - if((argc() > 1) && (argv(1) == 'force')) + if(($argc > 1) && ($argv[1] == 'force')) $force = true; - if((argc() > 1) && (argv(1) == 'restart')) { + if(($argc > 1) && ($argv[1] == 'restart')) { $restart = true; - $generation = intval(argv(2)); + $generation = intval($argv[2]); if(! $generation) killme(); } - if((argc() > 1) && intval(argv(1))) { - $manual_id = intval(argv(1)); + if(($argc > 1) && intval($argv[1])) { + $manual_id = intval($argv[1]); $force = true; } @@ -157,7 +157,8 @@ function poller_run($argv, $argc){ : '' ); - $contacts = q("SELECT abook_id, abook_updated, abook_closeness, abook_channel + + $contacts = q("SELECT abook_id, abook_updated, abook_connected, abook_closeness, abook_channel FROM abook LEFT JOIN account on abook_account = account_id where 1 $sql_extra AND (( abook_flags = %d ) OR ( abook_flags = %d )) @@ -189,10 +190,10 @@ function poller_run($argv, $argc){ else { // if we've never connected with them, start the mark for death countdown from now - if($c === '0000-00-00 00:00:00') { + if($c == '0000-00-00 00:00:00') { $r = q("update abook set abook_connected = '%s' where abook_id = %d limit 1", dbesc(datetime_convert()), - intval($abook['abook_id']) + intval($contact['abook_id']) ); $c = datetime_convert(); $update = true; @@ -200,8 +201,8 @@ function poller_run($argv, $argc){ // He's dead, Jim - if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $c . " + 30 day")) { - $r = q("update abook set abook_flags = (abook_flags & %d) where abook_id = %d limit 1", + if(strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $c . " + 30 day")) > 0) { + $r = q("update abook set abook_flags = (abook_flags | %d) where abook_id = %d limit 1", intval(ABOOK_FLAG_ARCHIVED), intval($contact['abook_id']) ); @@ -213,17 +214,17 @@ function poller_run($argv, $argc){ // recently deceased, so keep up the regular schedule for 3 days - if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $c . " + 3 day")) - && (datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day"))) + if((strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $c . " + 3 day")) > 0) + && (strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $t . " + 1 day")) > 0)) $update = true; // After that back off and put them on a morphine drip - if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 2 day")) { + if(strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $t . " + 2 day")) > 0) { $update = true; } } - +dbg(0); if((! $update) && (! $force)) continue; -- cgit v1.2.3 From 85e291f5357bc28b108378816af97b545aacca3f Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 29 Aug 2013 18:17:15 -0700 Subject: figure out why poller isn't picking up old posts which failed to deliver --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 7a6aaeb22..bdb0388ac 100644 --- a/include/poller.php +++ b/include/poller.php @@ -224,7 +224,7 @@ function poller_run($argv, $argc){ $update = true; } } -dbg(0); + if((! $update) && (! $force)) continue; -- cgit v1.2.3 From e9ea80f2f62a2ab53f5b6d74792de6b08fd98a03 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 12 Sep 2013 21:54:15 -0700 Subject: No point beating a dead horse --- include/poller.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index bdb0388ac..f084005c7 100644 --- a/include/poller.php +++ b/include/poller.php @@ -158,7 +158,7 @@ function poller_run($argv, $argc){ ); - $contacts = q("SELECT abook_id, abook_updated, abook_connected, abook_closeness, abook_channel + $contacts = q("SELECT abook_id, abook_flags, abook_updated, abook_connected, abook_closeness, abook_channel FROM abook LEFT JOIN account on abook_account = account_id where 1 $sql_extra AND (( abook_flags = %d ) OR ( abook_flags = %d )) @@ -210,6 +210,11 @@ function poller_run($argv, $argc){ continue; } + if($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) { + $update = false; + continue; + } + // might be dead, so maybe don't poll quite so often // recently deceased, so keep up the regular schedule for 3 days @@ -223,6 +228,8 @@ function poller_run($argv, $argc){ if(strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $t . " + 2 day")) > 0) { $update = true; } + + } if((! $update) && (! $force)) -- cgit v1.2.3 From e992cfeca9a80583b7cde12776fcfe279be02996 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 30 Sep 2013 18:33:27 -0700 Subject: directory sync - this will either work, or it won't work, or it will possibly recurse and blow up the matrix. Hard to say. Do you feel lucky? Well do ya' ... punk? Rule #1 - don't mess with anything unless it's blowing up the matrix. If it doesn't blow up the matrix, but doesn't work, just let it go and let's figure out what it is doing and what it isn't doing. The flow is as follows: Once a day go out to all the directory servers besides yourself and grab a list of updates. This happens in the poller. If we've never seen them before add them to the updates table. The poller also looks to see if we're a directory server and have updates that haven't yet been processed. It calls onedirsync.php to process each one. If we contact the channel to update and don't find anything (we're just doing a basic zot_finger), set a ud_last timestamp. If this is set we will only try once a day for seven days. Then we stop trying to update. This will probably cause a spike the first time through because you haven't seen any updates before, but we spread out the load over your delivery interval. --- include/poller.php | 128 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 74 insertions(+), 54 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index f084005c7..05584a05d 100644 --- a/include/poller.php +++ b/include/poller.php @@ -69,6 +69,8 @@ function poller_run($argv, $argc){ $d1 = get_config('system','last_expire_day'); $d2 = intval(datetime_convert('UTC','UTC','now','d')); + $dirmode = get_config('system','directory_mode'); + if($d2 != intval($d1)) { // If this is a directory server, request a sync with an upstream @@ -76,7 +78,6 @@ function poller_run($argv, $argc){ // Pull remote changes and push local changes. // potential issue: how do we keep from creating an endless update loop? - $dirmode = get_config('system','directory_mode'); if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) { require_once('include/dir_fns.php'); sync_directories($dirmode); @@ -171,76 +172,95 @@ function poller_run($argv, $argc){ ); - if(! $contacts) { - return; - } + if($contacts) { - foreach($contacts as $contact) { + foreach($contacts as $contact) { - $update = false; + $update = false; - $t = $contact['abook_updated']; - $c = $contact['abook_connected']; + $t = $contact['abook_updated']; + $c = $contact['abook_connected']; - if($c == $t) { - if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) - $update = true; - } - else { - // if we've never connected with them, start the mark for death countdown from now - - if($c == '0000-00-00 00:00:00') { - $r = q("update abook set abook_connected = '%s' where abook_id = %d limit 1", - dbesc(datetime_convert()), - intval($contact['abook_id']) - ); - $c = datetime_convert(); - $update = true; + if($c == $t) { + if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) + $update = true; } + else { + // if we've never connected with them, start the mark for death countdown from now + + if($c == '0000-00-00 00:00:00') { + $r = q("update abook set abook_connected = '%s' where abook_id = %d limit 1", + dbesc(datetime_convert()), + intval($contact['abook_id']) + ); + $c = datetime_convert(); + $update = true; + } + + // He's dead, Jim + + if(strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $c . " + 30 day")) > 0) { + $r = q("update abook set abook_flags = (abook_flags | %d) where abook_id = %d limit 1", + intval(ABOOK_FLAG_ARCHIVED), + intval($contact['abook_id']) + ); + $update = false; + continue; + } + + if($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) { + $update = false; + continue; + } + + // might be dead, so maybe don't poll quite so often + + // recently deceased, so keep up the regular schedule for 3 days + + if((strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $c . " + 3 day")) > 0) + && (strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $t . " + 1 day")) > 0)) + $update = true; - // He's dead, Jim + // After that back off and put them on a morphine drip + + if(strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $t . " + 2 day")) > 0) { + $update = true; + } - if(strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $c . " + 30 day")) > 0) { - $r = q("update abook set abook_flags = (abook_flags | %d) where abook_id = %d limit 1", - intval(ABOOK_FLAG_ARCHIVED), - intval($contact['abook_id']) - ); - $update = false; - continue; - } - if($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) { - $update = false; - continue; } - // might be dead, so maybe don't poll quite so often + if((! $update) && (! $force)) + continue; - // recently deceased, so keep up the regular schedule for 3 days - - if((strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $c . " + 3 day")) > 0) - && (strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $t . " + 1 day")) > 0)) - $update = true; + proc_run('php','include/onepoll.php',$contact['abook_id']); + if($interval) + @time_sleep_until(microtime(true) + (float) $interval); - // After that back off and put them on a morphine drip + } + } - if(strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $t . " + 2 day")) > 0) { - $update = true; + if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) { + $r = q("select ud_id from updates where not ( ud_flags & %d ) and ( ud_last = '0000-00-00 00:00:00' OR ud_last > UTC_TIMESTAMP() - INTERVAL 7 DAYS) ", + intval(UPDATE_FLAGS_UPDATED) + ); + if($r) { + foreach($r as $rr) { + + // If they didn't respond when we attempted before, back off to once a day + // After 7 days we won't bother anymore + + if($rr['ud_last'] != '0000-00-00 00:00:00') + if($rr['ud_last'] > datetime_convert('UTC','UTC', 'now - 1 day')) + continue; + proc_run('php','include/onedirsync.php',$rr['ud_id']); + if($interval) + @time_sleep_until(microtime(true) + (float) $interval); } - - } - - if((! $update) && (! $force)) - continue; - - proc_run('php','include/onepoll.php',$contact['abook_id']); - if($interval) - @time_sleep_until(microtime(true) + (float) $interval); - } - + return; } -- cgit v1.2.3 From 266c701034be20cccf42e18cdc336dc896c53d77 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 2 Oct 2013 04:04:37 -0700 Subject: directory sync typo --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 05584a05d..95eb810a0 100644 --- a/include/poller.php +++ b/include/poller.php @@ -242,7 +242,7 @@ function poller_run($argv, $argc){ } if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) { - $r = q("select ud_id from updates where not ( ud_flags & %d ) and ( ud_last = '0000-00-00 00:00:00' OR ud_last > UTC_TIMESTAMP() - INTERVAL 7 DAYS) ", + $r = q("select ud_id from updates where not ( ud_flags & %d ) and ( ud_last = '0000-00-00 00:00:00' OR ud_last > UTC_TIMESTAMP() - INTERVAL 7 DAY ) ", intval(UPDATE_FLAGS_UPDATED) ); if($r) { -- cgit v1.2.3 From 3a615528e8992055fc1dbff87db8531d3fee1eb7 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 14 Oct 2013 21:39:54 -0700 Subject: sync tweaks --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 95eb810a0..97571d331 100644 --- a/include/poller.php +++ b/include/poller.php @@ -242,7 +242,7 @@ function poller_run($argv, $argc){ } if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) { - $r = q("select ud_id from updates where not ( ud_flags & %d ) and ( ud_last = '0000-00-00 00:00:00' OR ud_last > UTC_TIMESTAMP() - INTERVAL 7 DAY ) ", + $r = q("select ud_id from updates where not ( ud_flags & %d ) and ud_addr != '' and ( ud_last = '0000-00-00 00:00:00' OR ud_last > UTC_TIMESTAMP() - INTERVAL 7 DAY ) ", intval(UPDATE_FLAGS_UPDATED) ); if($r) { -- cgit v1.2.3 From b75163fb80518efb9e06b374f5093da5d2e6f6d4 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 14 Oct 2013 22:04:45 -0700 Subject: why do these have invalid id's? --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 97571d331..48959fe61 100644 --- a/include/poller.php +++ b/include/poller.php @@ -242,7 +242,7 @@ function poller_run($argv, $argc){ } if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) { - $r = q("select ud_id from updates where not ( ud_flags & %d ) and ud_addr != '' and ( ud_last = '0000-00-00 00:00:00' OR ud_last > UTC_TIMESTAMP() - INTERVAL 7 DAY ) ", + $r = q("select * from updates where not ( ud_flags & %d ) and ud_addr != '' and ( ud_last = '0000-00-00 00:00:00' OR ud_last > UTC_TIMESTAMP() - INTERVAL 7 DAY ) ", intval(UPDATE_FLAGS_UPDATED) ); if($r) { -- cgit v1.2.3 From 66f427db5ea1c27f247ed329521695bc34a8fdd6 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 15 Oct 2013 02:33:35 -0700 Subject: directory sync optimisations to save redundant processing --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 48959fe61..94ca99e54 100644 --- a/include/poller.php +++ b/include/poller.php @@ -242,7 +242,7 @@ function poller_run($argv, $argc){ } if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) { - $r = q("select * from updates where not ( ud_flags & %d ) and ud_addr != '' and ( ud_last = '0000-00-00 00:00:00' OR ud_last > UTC_TIMESTAMP() - INTERVAL 7 DAY ) ", + $r = q("select distinct ud_addr, updates.* from updates where not ( ud_flags & %d ) and ud_addr != '' and ( ud_last = '0000-00-00 00:00:00' OR ud_last > UTC_TIMESTAMP() - INTERVAL 7 DAY ) group by ud_addr ", intval(UPDATE_FLAGS_UPDATED) ); if($r) { -- cgit v1.2.3 From 1bf6591e1b98ef6704ee1bab72bad7dca7ab301f Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 28 Oct 2013 00:11:44 -0700 Subject: implement monthly directory pings --- include/poller.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 94ca99e54..f3a997913 100644 --- a/include/poller.php +++ b/include/poller.php @@ -21,6 +21,11 @@ function poller_run($argv, $argc){ } } + $interval = intval(get_config('system','poll_interval')); + if(! $interval) + $interval = ((get_config('system','delivery_interval') === false) ? 3 : intval(get_config('system','delivery_interval'))); + + logger('poller: start'); // run queue delivery process in the background @@ -38,6 +43,19 @@ function poller_run($argv, $argc){ intval(ACCOUNT_EXPIRED) ); + // Ensure that every channel pings a directory server once a month. This way we can discover + // channels and sites that quietly vanished and prevent the directory from accumulating stale + // or dead entries. + + $r = q("select channel_id from channel where channel_dirdate < UTC_TIMESTAMP() - INTERVAL 30 DAY"); + if($r) { + foreach($r as $rr) { + proc_run('php','include/directory.php',$rr['channel_id']); + if($interval) + @time_sleep_until(microtime(true) + (float) $interval); + } + } + // publish any applicable items that were set to be published in the future // (time travel posts) @@ -134,9 +152,6 @@ function poller_run($argv, $argc){ $force = true; } - $interval = intval(get_config('system','poll_interval')); - if(! $interval) - $interval = ((get_config('system','delivery_interval') === false) ? 3 : intval(get_config('system','delivery_interval'))); $sql_extra = (($manual_id) ? " AND abook_id = $manual_id " : ""); -- cgit v1.2.3 From 6162de142c2765c770f43bf269f0444310551705 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 6 Nov 2013 18:28:36 -0800 Subject: allow private mail sender to set an expiration on their messages. Once expired the message is destroyed at both ends (subject to the granularity of the polling interval) and is gone. Officially it takes some form of language independent string like 2013/11/22, but English speakers can use anything that strtotime() understands, like "+30 minutes" or "next Tuesday". --- include/poller.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index f3a997913..b1f89955c 100644 --- a/include/poller.php +++ b/include/poller.php @@ -42,6 +42,11 @@ function poller_run($argv, $argc){ intval(ACCOUNT_EXPIRED), intval(ACCOUNT_EXPIRED) ); + + // expire any expired mail + + q("delete from mail where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() "); + // Ensure that every channel pings a directory server once a month. This way we can discover // channels and sites that quietly vanished and prevent the directory from accumulating stale -- cgit v1.2.3 From 7381326b7a7a271da52464d15774a1309adb2bd5 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 7 Nov 2013 00:47:50 -0800 Subject: provide expire feature on post and comments as well as private messages. This requires a feature setting and is currently unmaskable - if the author says it's gone, there's not a lot you can do to stop it or try and save it. It's gone. --- include/poller.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index b1f89955c..e5a274758 100644 --- a/include/poller.php +++ b/include/poller.php @@ -46,7 +46,13 @@ function poller_run($argv, $argc){ // expire any expired mail q("delete from mail where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() "); - + + $r = q("select id from item where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() "); + if($r) { + require_once('include/items.php'); + foreach($r as $rr) + drop_item($rr['id'],false); + } // Ensure that every channel pings a directory server once a month. This way we can discover // channels and sites that quietly vanished and prevent the directory from accumulating stale -- cgit v1.2.3 From 90ab0d963bf5074643c6f275dbb8595b6c51a03d Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 7 Nov 2013 22:45:13 -0800 Subject: we should probably only expire things once... --- include/poller.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index e5a274758..3c4e6402c 100644 --- a/include/poller.php +++ b/include/poller.php @@ -47,7 +47,10 @@ function poller_run($argv, $argc){ q("delete from mail where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() "); - $r = q("select id from item where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() "); + $r = q("select id from item where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() + and not ( item_restrict & %d ) ", + intval(ITEM_DELETED) + ); if($r) { require_once('include/items.php'); foreach($r as $rr) -- cgit v1.2.3 From 06e0272db873ad0b7dbc96596e92b8c635f940a2 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 17 Nov 2013 16:50:32 -0800 Subject: populate some posts when somebody is granted "read stream" permission --- include/poller.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 3c4e6402c..0dcec4c0f 100644 --- a/include/poller.php +++ b/include/poller.php @@ -117,7 +117,10 @@ function poller_run($argv, $argc){ set_config('system','last_expire_day',$d2); + // Uncomment when expire protocol component is working +// Update - this is not going to happen. We are only going to +// implement per-item expire, not blanket expiration // proc_run('php','include/expire.php'); proc_run('php','include/cli_suggest.php'); -- cgit v1.2.3 From 59094cda5166e58a451cb0372a59d8059cbacd6f Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 10 Feb 2014 20:38:26 -0800 Subject: reversed args in update_modtime, incorrect ud_guid and ud_hash --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 0dcec4c0f..76c82db09 100644 --- a/include/poller.php +++ b/include/poller.php @@ -64,7 +64,7 @@ function poller_run($argv, $argc){ $r = q("select channel_id from channel where channel_dirdate < UTC_TIMESTAMP() - INTERVAL 30 DAY"); if($r) { foreach($r as $rr) { - proc_run('php','include/directory.php',$rr['channel_id']); + proc_run('php','include/directory.php',$rr['channel_id'],'ping'); if($interval) @time_sleep_until(microtime(true) + (float) $interval); } -- cgit v1.2.3 From 2d9655627a0006dbf7d10afbbc2bcc0fdc2a3750 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Tue, 11 Feb 2014 20:14:45 +0000 Subject: Clear out old notifications in the poller. --- include/poller.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 76c82db09..4d191b853 100644 --- a/include/poller.php +++ b/include/poller.php @@ -56,7 +56,11 @@ function poller_run($argv, $argc){ foreach($r as $rr) drop_item($rr['id'],false); } - + + // expire any read notifications over a month old + + q("delete from notify where seen = 1 and date < UTC_TIMESTAMP() - INTERVAL 30 DAY"); + // Ensure that every channel pings a directory server once a month. This way we can discover // channels and sites that quietly vanished and prevent the directory from accumulating stale // or dead entries. -- cgit v1.2.3 From d02529fde1ee9d7ecf317ae30abce666e1b33eb4 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 11 Feb 2014 14:19:20 -0800 Subject: implement a forced directory update mode where we unconditionally create a directory sync packet. This is needed to ensure that monthly directory pings are propagated to other directory servers so they can each prove for themselves whether or not an account is alive or dead. We do not trust other directories to provide us information beyond "look at this entry and decide for yourself" as doing otherwise would invite rogue directory manipulations. As this scheduled update occurs on all channels across all servers, we should also pick up refresh messages from all existing channel clones and these should also propagate out to all directory servers using the same mechanism (though perhaps not at the same time). --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 76c82db09..eba765278 100644 --- a/include/poller.php +++ b/include/poller.php @@ -64,7 +64,7 @@ function poller_run($argv, $argc){ $r = q("select channel_id from channel where channel_dirdate < UTC_TIMESTAMP() - INTERVAL 30 DAY"); if($r) { foreach($r as $rr) { - proc_run('php','include/directory.php',$rr['channel_id'],'ping'); + proc_run('php','include/directory.php',$rr['channel_id'],'force'); if($interval) @time_sleep_until(microtime(true) + (float) $interval); } -- cgit v1.2.3 From 9498ed17ab4d71d926c47d02f4c9ae2f97e1a1d1 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 11 Feb 2014 14:35:02 -0800 Subject: move expiration of notifications to the equivalent of "cron daily" to try and reduce the number of things the poller has to do on every run. --- include/poller.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index f75ba2f22..ce9b75eb3 100644 --- a/include/poller.php +++ b/include/poller.php @@ -47,6 +47,8 @@ function poller_run($argv, $argc){ q("delete from mail where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() "); + // expire any expired items + $r = q("select id from item where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() and not ( item_restrict & %d ) ", intval(ITEM_DELETED) @@ -57,9 +59,6 @@ function poller_run($argv, $argc){ drop_item($rr['id'],false); } - // expire any read notifications over a month old - - q("delete from notify where seen = 1 and date < UTC_TIMESTAMP() - INTERVAL 30 DAY"); // Ensure that every channel pings a directory server once a month. This way we can discover // channels and sites that quietly vanished and prevent the directory from accumulating stale @@ -107,8 +106,16 @@ function poller_run($argv, $argc){ $dirmode = get_config('system','directory_mode'); + + // Actions in the following block are executed once per day, not on every poller run + if($d2 != intval($d1)) { + // expire any read notifications over a month old + + q("delete from notify where seen = 1 and date < UTC_TIMESTAMP() - INTERVAL 30 DAY"); + + // If this is a directory server, request a sync with an upstream // directory at least once a day, up to once every poll interval. // Pull remote changes and push local changes. @@ -119,14 +126,8 @@ function poller_run($argv, $argc){ sync_directories($dirmode); } - set_config('system','last_expire_day',$d2); -// Uncomment when expire protocol component is working -// Update - this is not going to happen. We are only going to -// implement per-item expire, not blanket expiration -// proc_run('php','include/expire.php'); - proc_run('php','include/cli_suggest.php'); } -- cgit v1.2.3 From 7d4916ec714d834db3493c2fc12e76b0ffdb26b2 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 18 Feb 2014 15:17:18 -0800 Subject: service class downgrade to the default service class on account expiration if using a non-default service class and account has expired. --- include/poller.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index ce9b75eb3..1c6f68eab 100644 --- a/include/poller.php +++ b/include/poller.php @@ -32,16 +32,6 @@ function poller_run($argv, $argc){ proc_run('php',"include/queue.php"); - // expire any expired accounts - - q("UPDATE account - SET account_flags = (account_flags | %d) - where not (account_flags & %d) - and account_expires != '0000-00-00 00:00:00' - and account_expires < UTC_TIMESTAMP() ", - intval(ACCOUNT_EXPIRED), - intval(ACCOUNT_EXPIRED) - ); // expire any expired mail @@ -115,6 +105,9 @@ function poller_run($argv, $argc){ q("delete from notify where seen = 1 and date < UTC_TIMESTAMP() - INTERVAL 30 DAY"); + // expire any expired accounts + require_once('include/account.php'); + downgrade_accounts(); // If this is a directory server, request a sync with an upstream // directory at least once a day, up to once every poll interval. -- cgit v1.2.3 From 7cdca97654658fe8de5ad38871defc8f6b2100ec Mon Sep 17 00:00:00 2001 From: cvogeley Date: Thu, 27 Feb 2014 09:54:07 +0100 Subject: Typo --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 1c6f68eab..77452cafa 100644 --- a/include/poller.php +++ b/include/poller.php @@ -76,7 +76,7 @@ function poller_run($argv, $argc){ intval($rr['id']) ); if($x) { - proc_run('php','include/notifer.php','wall-new',$rr['id']); + proc_run('php','include/notifier.php','wall-new',$rr['id']); } } } -- cgit v1.2.3 From bfd9f5ec87ed0b21e278ea5c94016623c9985850 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 3 Mar 2014 19:15:11 -0800 Subject: enable network/matrix expiration, this should be functional but the options have been reduced/restricted so we're only looking at network posts and ignore anything that is filed, starred, or is resource_type 'photo' (which should not be possible in non-wall posts, but we just want to be sure). Will require the adventurous tester(s) to set 'channel_expire_days' in their channel record. --- include/poller.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 77452cafa..649da30f6 100644 --- a/include/poller.php +++ b/include/poller.php @@ -96,9 +96,13 @@ function poller_run($argv, $argc){ $dirmode = get_config('system','directory_mode'); + /** + * Cron Daily + * + * Actions in the following block are executed once per day, not on every poller run + * + */ - // Actions in the following block are executed once per day, not on every poller run - if($d2 != intval($d1)) { // expire any read notifications over a month old @@ -121,6 +125,7 @@ function poller_run($argv, $argc){ set_config('system','last_expire_day',$d2); + proc_run('php','include/expire.php'); proc_run('php','include/cli_suggest.php'); } -- cgit v1.2.3 From 86d60f572f6accb086f7cd4271ababde2c5d3669 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Mar 2014 14:35:42 -0800 Subject: change flags for one-way connections from hidden to unconnected so we can still use hidden for - well hiding connections --- include/poller.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 649da30f6..423ee46c1 100644 --- a/include/poller.php +++ b/include/poller.php @@ -184,9 +184,7 @@ function poller_run($argv, $argc){ if(! $restart) proc_run('php','include/cronhooks.php'); - // Only poll from those with suitable relationships, - // and which have a polling address and ignore Diaspora since - // we are unable to match those posts with a Diaspora GUID and prevent duplicates. + // Only poll from those with suitable relationships $abandon_sql = (($abandon_days) ? sprintf(" AND account_lastlog > UTC_TIMESTAMP() - INTERVAL %d DAY ", intval($abandon_days)) @@ -197,10 +195,9 @@ function poller_run($argv, $argc){ $contacts = q("SELECT abook_id, abook_flags, abook_updated, abook_connected, abook_closeness, abook_channel FROM abook LEFT JOIN account on abook_account = account_id where 1 $sql_extra - AND (( abook_flags = %d ) OR ( abook_flags = %d )) + AND (( abook_flags & %d ) OR ( abook_flags = %d )) AND (( account_flags = %d ) OR ( account_flags = %d )) $abandon_sql ORDER BY RAND()", - - intval(ABOOK_FLAG_HIDDEN), + intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED), intval(0), intval(ACCOUNT_OK), intval(ACCOUNT_UNVERIFIED) // FIXME -- cgit v1.2.3 From 68fc2a220e81589d86af0233b533b6b713545a24 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 19 Mar 2014 19:53:14 -0700 Subject: prune_hub_reinstalls() and add cron weekly as a side effect --- include/poller.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 423ee46c1..bae39dd2e 100644 --- a/include/poller.php +++ b/include/poller.php @@ -105,6 +105,23 @@ function poller_run($argv, $argc){ if($d2 != intval($d1)) { + $d3 = intval(datetime_convert('UTC','UTC','now','N')); + if($d3 == 7) { + + /** + * Cron Weekly + * + * Actions in the following block are executed once per day only on Sunday (once per week). + * + */ + + require_once('include/hubloc.php'); + prune_hub_reinstalls(); + + + } + + // expire any read notifications over a month old q("delete from notify where seen = 1 and date < UTC_TIMESTAMP() - INTERVAL 30 DAY"); -- cgit v1.2.3 From ed14c1f224afadb5dd5417d4078f853ff97b30cb Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Mar 2014 18:45:01 -0700 Subject: more work on firehose --- include/poller.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index bae39dd2e..aa09afd5d 100644 --- a/include/poller.php +++ b/include/poller.php @@ -167,6 +167,30 @@ function poller_run($argv, $argc){ } } + // pull in some public posts + + $r = q("select site_url from site where site_url != '%s' order by rand() limit 1", + dbesc(z_root()) + ); + + if($r) { + $feedurl = $r[0]['site_url'] . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 1 month')); + $x = z_fetch_url($feedurl); + if(($x) && ($x['success'])) { + $total = 0; + $j = json_decode($x['body'],true); + if($j['success'] && $j['messages']) { + require_once('include/identity.php'); + $sys = get_sys_channel(); + foreach($j['messages'] as $message) { + $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message), + array(array('hash' => $sys['xchan_hash'])), false, true); + $total ++; + } + logger('import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG); + } + } + } $manual_id = 0; $generation = 0; -- cgit v1.2.3 From 20717e34162d3759408fd5300548fc4cfa1b2263 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Mar 2014 19:23:45 -0700 Subject: let's limit this to two weeks so it doesn't pound servers and waste too much space --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index aa09afd5d..d873058a6 100644 --- a/include/poller.php +++ b/include/poller.php @@ -174,7 +174,7 @@ function poller_run($argv, $argc){ ); if($r) { - $feedurl = $r[0]['site_url'] . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 1 month')); + $feedurl = $r[0]['site_url'] . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 15 days')); $x = z_fetch_url($feedurl); if(($x) && ($x['success'])) { $total = 0; -- cgit v1.2.3 From 5a3903a40c508a6b5e9a90986564e5c4918223cc Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 26 Mar 2014 22:05:19 -0700 Subject: firehose testing (network?f=&fh=1) - some possible security bugs so testing purposes only --- include/poller.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index d873058a6..9b8ac4165 100644 --- a/include/poller.php +++ b/include/poller.php @@ -176,6 +176,7 @@ function poller_run($argv, $argc){ if($r) { $feedurl = $r[0]['site_url'] . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 15 days')); $x = z_fetch_url($feedurl); + if(($x) && ($x['success'])) { $total = 0; $j = json_decode($x['body'],true); -- cgit v1.2.3 From a0674af4169a8c929c89887d4e7796b21ee55a91 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Mar 2014 15:35:29 -0700 Subject: firehose fixes and optimisations. In particular get rid of the unresponsive script warning when trying to load updates (sine they aren't our posts, we can't check for unseen, hence we can't really load updates). Also make the url selection pluggable. --- include/poller.php | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 9b8ac4165..19037ef17 100644 --- a/include/poller.php +++ b/include/poller.php @@ -167,31 +167,10 @@ function poller_run($argv, $argc){ } } - // pull in some public posts - $r = q("select site_url from site where site_url != '%s' order by rand() limit 1", - dbesc(z_root()) - ); + // pull in some public posts + proc_run('php','include/externals.php'); - if($r) { - $feedurl = $r[0]['site_url'] . '/zotfeed?f=&mindate=' . urlencode(datetime_convert('','','now - 15 days')); - $x = z_fetch_url($feedurl); - - if(($x) && ($x['success'])) { - $total = 0; - $j = json_decode($x['body'],true); - if($j['success'] && $j['messages']) { - require_once('include/identity.php'); - $sys = get_sys_channel(); - foreach($j['messages'] as $message) { - $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message), - array(array('hash' => $sys['xchan_hash'])), false, true); - $total ++; - } - logger('import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG); - } - } - } $manual_id = 0; $generation = 0; -- cgit v1.2.3 From fedd19ec95bfe963ab19d9e55f184b8ffe9f0da0 Mon Sep 17 00:00:00 2001 From: Alexandre Hannud Abdo Date: Sat, 29 Mar 2014 23:20:43 -0300 Subject: Let the site admin choose whether to display the Discover tab. --- include/poller.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 19037ef17..0eb161862 100644 --- a/include/poller.php +++ b/include/poller.php @@ -169,7 +169,8 @@ function poller_run($argv, $argc){ // pull in some public posts - proc_run('php','include/externals.php'); + if(get_config('system','discover_tab')) + proc_run('php','include/externals.php'); $manual_id = 0; -- cgit v1.2.3 From 1093e8d83efeabc7f4154ce04b5f7f554b9957e5 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 30 Mar 2014 22:59:37 +0100 Subject: Default discover to on. --- include/poller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 0eb161862..9592c29e4 100644 --- a/include/poller.php +++ b/include/poller.php @@ -169,7 +169,7 @@ function poller_run($argv, $argc){ // pull in some public posts - if(get_config('system','discover_tab')) + if(! get_config('system','disable_discover_tab')) proc_run('php','include/externals.php'); -- cgit v1.2.3 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. --- include/poller.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 9592c29e4..35844e666 100644 --- a/include/poller.php +++ b/include/poller.php @@ -118,10 +118,11 @@ function poller_run($argv, $argc){ require_once('include/hubloc.php'); prune_hub_reinstalls(); + require_once('include/Contact.php'); + mark_orphan_hubsxchans(); } - // expire any read notifications over a month old q("delete from notify where seen = 1 and date < UTC_TIMESTAMP() - INTERVAL 30 DAY"); -- cgit v1.2.3 From 2386bc4d00bac9a1ad1ae50380c351f46e4ca5c2 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 2 Jun 2014 17:49:19 -0700 Subject: bring back birthdays --- include/poller.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 35844e666..926deeb47 100644 --- a/include/poller.php +++ b/include/poller.php @@ -123,6 +123,8 @@ function poller_run($argv, $argc){ } + update_birthdays(); + // expire any read notifications over a month old q("delete from notify where seen = 1 and date < UTC_TIMESTAMP() - INTERVAL 30 DAY"); -- cgit v1.2.3 From 376a51f8d8f2fd49ebbb8ac6a868cb151076db97 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 6 Jun 2014 23:56:52 -0700 Subject: doc updates --- include/poller.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index 926deeb47..ec013c9c7 100644 --- a/include/poller.php +++ b/include/poller.php @@ -105,6 +105,9 @@ function poller_run($argv, $argc){ if($d2 != intval($d1)) { + call_hooks('cron_daily',datetime_convert()); + + $d3 = intval(datetime_convert('UTC','UTC','now','N')); if($d3 == 7) { @@ -115,6 +118,11 @@ function poller_run($argv, $argc){ * */ + + call_hooks('cron_weekly',datetime_convert()); + + + require_once('include/hubloc.php'); prune_hub_reinstalls(); @@ -204,7 +212,7 @@ function poller_run($argv, $argc){ $d = datetime_convert(); -//TODO check to see if there are any cronhooks before wasting a process + //TODO check to see if there are any cronhooks before wasting a process if(! $restart) proc_run('php','include/cronhooks.php'); -- cgit v1.2.3