mirror of
https://github.com/friendica/friendica
synced 2025-04-29 02:24:22 +02:00
Move NULL_DATE from boot.php to DBA::NULL_DATETIME
- Add DBA::NULL_DATE constant
This commit is contained in:
parent
ca9cad3491
commit
e511790d62
19 changed files with 70 additions and 73 deletions
|
@ -5,17 +5,17 @@
|
|||
|
||||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
/**
|
||||
* Handle Authentification, Session and Cookies
|
||||
*/
|
||||
*/
|
||||
class Authentication extends BaseObject
|
||||
{
|
||||
/**
|
||||
|
@ -81,7 +81,7 @@ class Authentication extends BaseObject
|
|||
$a->user = $user_record;
|
||||
|
||||
if ($interactive) {
|
||||
if ($a->user['login_date'] <= NULL_DATE) {
|
||||
if ($a->user['login_date'] <= DBA::NULL_DATETIME) {
|
||||
$_SESSION['return_path'] = 'profile_photo/new';
|
||||
$a->module = 'profile_photo';
|
||||
info(L10n::t("Welcome ") . $a->user['username'] . EOL);
|
||||
|
|
|
@ -180,7 +180,7 @@ class UserImport
|
|||
}
|
||||
if ($contact['uid'] == $olduid && $contact['self'] == '0') {
|
||||
// set contacts 'avatar-date' to NULL_DATE to let worker to update urls
|
||||
$contact["avatar-date"] = NULL_DATE;
|
||||
$contact["avatar-date"] = DBA::NULL_DATETIME;
|
||||
|
||||
switch ($contact['network']) {
|
||||
case Protocol::DFRN:
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
*/
|
||||
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';
|
||||
|
||||
|
@ -154,7 +154,7 @@ class Worker
|
|||
private static function totalEntries()
|
||||
{
|
||||
return DBA::count('workerqueue', ["`executed` <= ? AND NOT `done` AND `next_try` < ?",
|
||||
NULL_DATE, DateTimeFormat::utcNow()]);
|
||||
DBA::NULL_DATETIME, DateTimeFormat::utcNow()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -164,7 +164,7 @@ class Worker
|
|||
*/
|
||||
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"];
|
||||
|
@ -183,7 +183,7 @@ class Worker
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -553,7 +553,7 @@ class Worker
|
|||
$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']]
|
||||
);
|
||||
|
||||
|
@ -561,7 +561,7 @@ class Worker
|
|||
if (!posix_kill($entry["pid"], 0)) {
|
||||
DBA::update(
|
||||
'workerqueue',
|
||||
['executed' => NULL_DATE, 'pid' => 0],
|
||||
['executed' => DBA::NULL_DATETIME, 'pid' => 0],
|
||||
['id' => $entry["id"]]
|
||||
);
|
||||
} else {
|
||||
|
@ -597,7 +597,7 @@ class Worker
|
|||
}
|
||||
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 {
|
||||
|
@ -809,7 +809,7 @@ class Worker
|
|||
'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']]
|
||||
);
|
||||
|
||||
|
@ -826,7 +826,7 @@ class Worker
|
|||
'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']]
|
||||
);
|
||||
|
||||
|
@ -846,7 +846,7 @@ class Worker
|
|||
'workerqueue',
|
||||
['id'],
|
||||
["`executed` <= ? AND NOT `done` AND `next_try` < ?",
|
||||
NULL_DATE, DateTimeFormat::utcNow()],
|
||||
DBA::NULL_DATETIME, DateTimeFormat::utcNow()],
|
||||
['limit' => $limit, 'order' => ['priority', 'created']]
|
||||
);
|
||||
|
||||
|
@ -912,7 +912,7 @@ class Worker
|
|||
{
|
||||
$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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1147,7 +1147,7 @@ class Worker
|
|||
|
||||
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]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue