mirror of
https://github.com/friendica/friendica
synced 2025-05-01 03:04:23 +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
|
@ -8,7 +8,6 @@ use Friendica\BaseObject;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
|
@ -17,8 +16,8 @@ use Friendica\Model\Profile;
|
|||
use Friendica\Network\Probe;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use Friendica\Protocol\Salmon;
|
||||
|
@ -594,9 +593,9 @@ class Contact extends BaseObject
|
|||
return;
|
||||
}
|
||||
|
||||
if ($contact['term-date'] <= NULL_DATE) {
|
||||
if ($contact['term-date'] <= DBA::NULL_DATETIME) {
|
||||
DBA::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
|
||||
DBA::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE]);
|
||||
DBA::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), DBA::NULL_DATETIME]);
|
||||
} else {
|
||||
/* @todo
|
||||
* We really should send a notification to the owner after 2-3 weeks
|
||||
|
@ -629,7 +628,7 @@ class Contact extends BaseObject
|
|||
*/
|
||||
public static function unmarkForArchival(array $contact)
|
||||
{
|
||||
$condition = ['`id` = ? AND (`term-date` > ? OR `archive`)', $contact['id'], NULL_DATE];
|
||||
$condition = ['`id` = ? AND (`term-date` > ? OR `archive`)', $contact['id'], DBA::NULL_DATETIME];
|
||||
$exists = DBA::exists('contact', $condition);
|
||||
|
||||
// We don't need to update, we never marked this contact for archival
|
||||
|
@ -646,7 +645,7 @@ class Contact extends BaseObject
|
|||
}
|
||||
|
||||
// It's a miracle. Our dead contact has inexplicably come back to life.
|
||||
$fields = ['term-date' => NULL_DATE, 'archive' => false];
|
||||
$fields = ['term-date' => DBA::NULL_DATETIME, 'archive' => false];
|
||||
DBA::update('contact', $fields, ['id' => $contact['id']]);
|
||||
DBA::update('contact', $fields, ['nurl' => normalise_link($contact['url'])]);
|
||||
|
||||
|
|
|
@ -257,10 +257,10 @@ class Event extends BaseObject
|
|||
|
||||
$event['created'] = DateTimeFormat::utc(defaults($arr, 'created' , 'now'));
|
||||
$event['edited'] = DateTimeFormat::utc(defaults($arr, 'edited' , 'now'));
|
||||
$event['start'] = DateTimeFormat::utc(defaults($arr, 'start' , NULL_DATE));
|
||||
$event['finish'] = DateTimeFormat::utc(defaults($arr, 'finish' , NULL_DATE));
|
||||
if ($event['finish'] < NULL_DATE) {
|
||||
$event['finish'] = NULL_DATE;
|
||||
$event['start'] = DateTimeFormat::utc(defaults($arr, 'start' , DBA::NULL_DATETIME));
|
||||
$event['finish'] = DateTimeFormat::utc(defaults($arr, 'finish' , DBA::NULL_DATETIME));
|
||||
if ($event['finish'] < DBA::NULL_DATETIME) {
|
||||
$event['finish'] = DBA::NULL_DATETIME;
|
||||
}
|
||||
$private = intval(defaults($arr, 'private', 0));
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ class GContact
|
|||
if (!isset($gcontact['network']) && ($gcnt["network"] != Protocol::STATUSNET)) {
|
||||
$gcontact['network'] = $gcnt["network"];
|
||||
}
|
||||
if ($gcontact['updated'] <= NULL_DATE) {
|
||||
if ($gcontact['updated'] <= DBA::NULL_DATETIME) {
|
||||
$gcontact['updated'] = $gcnt["updated"];
|
||||
}
|
||||
if (!isset($gcontact['server_url']) && (normalise_link($gcnt["server_url"]) != normalise_link($gcnt["url"]))) {
|
||||
|
@ -457,7 +457,7 @@ class GContact
|
|||
intval($uid),
|
||||
intval($uid),
|
||||
intval($uid),
|
||||
DBA::escape(NULL_DATE),
|
||||
DBA::NULL_DATETIME,
|
||||
$sql_network,
|
||||
intval($start),
|
||||
intval($limit)
|
||||
|
@ -486,7 +486,7 @@ class GContact
|
|||
intval($uid),
|
||||
intval($uid),
|
||||
intval($uid),
|
||||
DBA::escape(NULL_DATE),
|
||||
DBA::NULL_DATETIME,
|
||||
$sql_network,
|
||||
intval($start),
|
||||
intval($limit)
|
||||
|
|
|
@ -774,7 +774,7 @@ class Profile
|
|||
$profile['marital']['with'] = $a->profile['with'];
|
||||
}
|
||||
|
||||
if (strlen($a->profile['howlong']) && $a->profile['howlong'] >= NULL_DATE) {
|
||||
if (strlen($a->profile['howlong']) && $a->profile['howlong'] >= DBA::NULL_DATETIME) {
|
||||
$profile['howlong'] = Temporal::getRelativeDate($a->profile['howlong'], L10n::t('for %1$d %2$s'));
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class PushSubscriber
|
|||
public static function publishFeed($uid, $default_priority = PRIORITY_HIGH)
|
||||
{
|
||||
$condition = ['push' => 0, 'uid' => $uid];
|
||||
DBA::update('push_subscriber', ['push' => 1, 'next_try' => NULL_DATE], $condition);
|
||||
DBA::update('push_subscriber', ['push' => 1, 'next_try' => DBA::NULL_DATETIME], $condition);
|
||||
|
||||
self::requeue($default_priority);
|
||||
}
|
||||
|
@ -114,10 +114,10 @@ class PushSubscriber
|
|||
$days = round((time() - strtotime($subscriber['renewed'])) / (60 * 60 * 24));
|
||||
|
||||
if ($days > 60) {
|
||||
DBA::update('push_subscriber', ['push' => -1, 'next_try' => NULL_DATE], ['id' => $id]);
|
||||
DBA::update('push_subscriber', ['push' => -1, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]);
|
||||
logger('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.', LOGGER_DEBUG);
|
||||
} else {
|
||||
DBA::update('push_subscriber', ['push' => 0, 'next_try' => NULL_DATE], ['id' => $id]);
|
||||
DBA::update('push_subscriber', ['push' => 0, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]);
|
||||
logger('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.', LOGGER_DEBUG);
|
||||
}
|
||||
} else {
|
||||
|
@ -146,7 +146,7 @@ class PushSubscriber
|
|||
}
|
||||
|
||||
// set last_update to the 'created' date of the last item, and reset push=0
|
||||
$fields = ['push' => 0, 'next_try' => NULL_DATE, 'last_update' => $last_update];
|
||||
$fields = ['push' => 0, 'next_try' => DBA::NULL_DATETIME, 'last_update' => $last_update];
|
||||
DBA::update('push_subscriber', $fields, ['id' => $id]);
|
||||
logger('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital', LOGGER_DEBUG);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue