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';
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);
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");
// once daily run birthday_updates and then expire in background
$d1 = Config::get('system', 'last_expire_day');
- $d2 = intval(Temporal::convert('now', 'UTC', 'UTC', 'd'));
+ $d2 = intval(DateTimeFormat::utcNow('d'));
if ($d2 != intval($d1)) {
Addon::reload();
- $d = Temporal::convert();
+ $d = DateTimeFormat::utcNow();
// Only poll from those with suitable relationships,
// and which have a polling address and ignore Diaspora since
*/
switch ($contact['priority']) {
case 5:
- if (Temporal::convert('now') > Temporal::convert($t . " + 1 month")) {
+ if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + 1 month")) {
$update = true;
}
break;
case 4:
- if (Temporal::convert('now') > Temporal::convert($t . " + 1 week")) {
+ if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + 1 week")) {
$update = true;
}
break;
case 3:
- if (Temporal::convert('now') > Temporal::convert($t . " + 1 day")) {
+ if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + 1 day")) {
$update = true;
}
break;
case 2:
- if (Temporal::convert('now') > Temporal::convert($t . " + 12 hour")) {
+ if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + 12 hour")) {
$update = true;
}
break;
case 1:
- if (Temporal::convert('now') > Temporal::convert($t . " + 1 hour")) {
+ if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + 1 hour")) {
$update = true;
}
break;
case 0:
default:
- if (Temporal::convert('now') > Temporal::convert($t . " + ".$min_poll_interval." minute")) {
+ if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + ".$min_poll_interval." minute")) {
$update = true;
}
break;