X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FCron.php;h=e523f75118af8ad0c415f2db2374a33f6ccf3799;hb=27d94023eef0263a3ce9750f79a73ac941a25304;hp=07ddf8bee4fa6377916d2d608b45b35c1b649d97;hpb=8aff8a76eb9efc4acaab0af3c8c0ca7a011f4349;p=friendica.git diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 07ddf8bee4..e523f75118 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -8,7 +8,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\Worker; use Friendica\Database\DBM; -use Friendica\Util\Temporal; +use Friendica\Util\DateTimeFormat; use dba; require_once 'include/dba.php'; @@ -17,8 +17,6 @@ Class Cron { public static function execute($parameter = '', $generation = 0) { global $a; - require_once 'include/datetime.php'; - // Poll contacts with specific parameters if (!empty($parameter)) { self::pollContacts($parameter, $generation); @@ -42,6 +40,9 @@ Class Cron { logger('cron: start'); + // Fork the cron jobs in separate parts to avoid problems when one of them is crashing + Addon::forkHooks($a->queue['priority'], "cron"); + // run queue delivery process in the background Worker::add(PRIORITY_NEGLIGIBLE, "Queue"); @@ -71,7 +72,7 @@ Class Cron { // once daily run birthday_updates and then expire in background $d1 = Config::get('system', 'last_expire_day'); - $d2 = intval(Temporal::utcNow('d')); + $d2 = intval(DateTimeFormat::utcNow('d')); if ($d2 != intval($d1)) { @@ -142,7 +143,7 @@ Class Cron { Addon::reload(); - $d = Temporal::utcNow(); + $d = DateTimeFormat::utcNow(); // Only poll from those with suitable relationships, // and which have a polling address and ignore Diaspora since @@ -218,33 +219,33 @@ Class Cron { */ switch ($contact['priority']) { case 5: - if (Temporal::utcNow() > Temporal::convert($t . " + 1 month")) { + if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + 1 month")) { $update = true; } break; case 4: - if (Temporal::utcNow() > Temporal::convert($t . " + 1 week")) { + if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + 1 week")) { $update = true; } break; case 3: - if (Temporal::utcNow() > Temporal::convert($t . " + 1 day")) { + if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + 1 day")) { $update = true; } break; case 2: - if (Temporal::utcNow() > Temporal::convert($t . " + 12 hour")) { + if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + 12 hour")) { $update = true; } break; case 1: - if (Temporal::utcNow() > Temporal::convert($t . " + 1 hour")) { + if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + 1 hour")) { $update = true; } break; case 0: default: - if (Temporal::utcNow() > Temporal::convert($t . " + ".$min_poll_interval." minute")) { + if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + ".$min_poll_interval." minute")) { $update = true; } break;