From f11856f839994c00eae2fdffe3f6f7b21dcf87a3 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 16 Jul 2014 16:21:01 -0700 Subject: allow a site to run cron daily at a chosen hour --- include/poller.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index ec013c9c7..546a2d6d1 100644 --- a/include/poller.php +++ b/include/poller.php @@ -91,9 +91,15 @@ function poller_run($argv, $argc){ // FIXME: add birthday updates, both locally and for xprof for use // by directory servers - $d1 = get_config('system','last_expire_day'); + $d1 = intval(get_config('system','last_expire_day')); $d2 = intval(datetime_convert('UTC','UTC','now','d')); + // Allow somebody to staggger daily activities if they have more than one site on their server, + // or if it happens at an inconvenient (busy) hour. + + $h1 = intval(get_config('system','cron_hour')); + $h2 = intval(datetime_convert('UTC','UTC','now','G')); + $dirmode = get_config('system','directory_mode'); /** @@ -103,7 +109,7 @@ function poller_run($argv, $argc){ * */ - if($d2 != intval($d1)) { + if(($d2 != $d1) && ($h1 == $h2)) { call_hooks('cron_daily',datetime_convert()); @@ -129,6 +135,10 @@ function poller_run($argv, $argc){ require_once('include/Contact.php'); mark_orphan_hubsxchans(); + + /** + * End Cron Weekly + */ } update_birthdays(); @@ -156,6 +166,9 @@ function poller_run($argv, $argc){ proc_run('php','include/expire.php'); proc_run('php','include/cli_suggest.php'); + /** + * End Cron Daily + */ } // update any photos which didn't get imported properly @@ -180,7 +193,8 @@ function poller_run($argv, $argc){ // pull in some public posts - if(! get_config('system','disable_discover_tab')) + + if(! get_config('system','disable_discover_tab')) proc_run('php','include/externals.php'); -- cgit v1.2.3