*/
namespace Friendica\Core;
+use Friendica\BaseObject;
use Friendica\Database\DBA;
use Friendica\Model\Process;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
-use Friendica\BaseObject;
require_once 'include/dba.php';
private static function totalEntries()
{
return DBA::count('workerqueue', ["`executed` <= ? AND NOT `done` AND `next_try` < ?",
- NULL_DATE, DateTimeFormat::utcNow()]);
+ DBA::NULL_DATETIME, DateTimeFormat::utcNow()]);
}
/**
*/
private static function highestPriority()
{
- $condition = ["`executed` <= ? AND NOT `done` AND `next_try` < ?", NULL_DATE, DateTimeFormat::utcNow()];
+ $condition = ["`executed` <= ? AND NOT `done` AND `next_try` < ?", DBA::NULL_DATETIME, DateTimeFormat::utcNow()];
$workerqueue = DBA::selectFirst('workerqueue', ['priority'], $condition, ['order' => ['priority']]);
if (DBA::isResult($workerqueue)) {
return $workerqueue["priority"];
private static function processWithPriorityActive($priority)
{
$condition = ["`priority` <= ? AND `executed` > ? AND NOT `done` AND `next_try` < ?",
- $priority, NULL_DATE, DateTimeFormat::utcNow()];
+ $priority, DBA::NULL_DATETIME, DateTimeFormat::utcNow()];
return DBA::exists('workerqueue', $condition);
}
$entries = DBA::select(
'workerqueue',
['id', 'pid', 'executed', 'priority', 'parameter'],
- ['`executed` > ? AND NOT `done` AND `pid` != 0', NULL_DATE],
+ ['`executed` > ? AND NOT `done` AND `pid` != 0', DBA::NULL_DATETIME],
['order' => ['priority', 'created']]
);
if (!posix_kill($entry["pid"], 0)) {
DBA::update(
'workerqueue',
- ['executed' => NULL_DATE, 'pid' => 0],
+ ['executed' => DBA::NULL_DATETIME, 'pid' => 0],
['id' => $entry["id"]]
);
} else {
}
DBA::update(
'workerqueue',
- ['executed' => NULL_DATE, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0],
+ ['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0],
['id' => $entry["id"]]
);
} else {
'workerqueue',
['id'],
["`executed` <= ? AND `priority` < ? AND NOT `done` AND `next_try` < ?",
- NULL_DATE, $highest_priority, DateTimeFormat::utcNow()],
+ DBA::NULL_DATETIME, $highest_priority, DateTimeFormat::utcNow()],
['limit' => $limit, 'order' => ['priority', 'created']]
);
'workerqueue',
['id'],
["`executed` <= ? AND `priority` > ? AND NOT `done` AND `next_try` < ?",
- NULL_DATE, $highest_priority, DateTimeFormat::utcNow()],
+ DBA::NULL_DATETIME, $highest_priority, DateTimeFormat::utcNow()],
['limit' => $limit, 'order' => ['priority', 'created']]
);
'workerqueue',
['id'],
["`executed` <= ? AND NOT `done` AND `next_try` < ?",
- NULL_DATE, DateTimeFormat::utcNow()],
+ DBA::NULL_DATETIME, DateTimeFormat::utcNow()],
['limit' => $limit, 'order' => ['priority', 'created']]
);
{
$mypid = getmypid();
- DBA::update('workerqueue', ['executed' => NULL_DATE, 'pid' => 0], ['pid' => $mypid, 'done' => false]);
+ DBA::update('workerqueue', ['executed' => DBA::NULL_DATETIME, 'pid' => 0], ['pid' => $mypid, 'done' => false]);
}
/**
logger('Defer execution ' . $retrial . ' of id ' . $id . ' to ' . $next, LOGGER_DEBUG);
- $fields = ['retrial' => $retrial + 1, 'next_try' => $next, 'executed' => NULL_DATE, 'pid' => 0];
+ $fields = ['retrial' => $retrial + 1, 'next_try' => $next, 'executed' => DBA::NULL_DATETIME, 'pid' => 0];
DBA::update('workerqueue', $fields, ['id' => $id]);
}