mirror of
https://github.com/friendica/friendica
synced 2024-11-18 04:23:41 +00: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
boot.php
5
boot.php
|
@ -345,11 +345,6 @@ define('SR_SCOPE_ALL', 'all');
|
|||
define('SR_SCOPE_TAGS', 'tags');
|
||||
/* @}*/
|
||||
|
||||
/**
|
||||
* Lowest possible date time value
|
||||
*/
|
||||
define('NULL_DATE', '0001-01-01 00:00:00');
|
||||
|
||||
// Normally this constant is defined - but not if "pcntl" isn't installed
|
||||
if (!defined("SIGTERM")) {
|
||||
define("SIGTERM", 15);
|
||||
|
|
|
@ -15,9 +15,9 @@ use Friendica\Database\DBA;
|
|||
use Friendica\Model\Event;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
require_once 'include/items.php';
|
||||
|
||||
|
@ -66,8 +66,8 @@ function events_post(App $a)
|
|||
// The default setting for the `private` field in event_store() is false, so mirror that
|
||||
$private_event = false;
|
||||
|
||||
$start = NULL_DATE;
|
||||
$finish = NULL_DATE;
|
||||
$start = DBA::NULL_DATETIME;
|
||||
$finish = DBA::NULL_DATETIME;
|
||||
|
||||
if ($start_text) {
|
||||
$start = $start_text;
|
||||
|
@ -111,7 +111,7 @@ function events_post(App $a)
|
|||
$a->internalRedirect($onerror_path);
|
||||
}
|
||||
|
||||
if (!$summary || ($start === NULL_DATE)) {
|
||||
if (!$summary || ($start === DBA::NULL_DATETIME)) {
|
||||
notice(L10n::t('Event title and start time are required.') . EOL);
|
||||
if (intval($_REQUEST['preview'])) {
|
||||
echo L10n::t('Event title and start time are required.');
|
||||
|
|
|
@ -18,10 +18,10 @@ use Friendica\Database\DBA;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
function profiles_init(App $a) {
|
||||
|
||||
|
@ -252,7 +252,7 @@ function profiles_post(App $a) {
|
|||
$with = ((x($_POST,'with')) ? notags(trim($_POST['with'])) : '');
|
||||
|
||||
if (! strlen($howlong)) {
|
||||
$howlong = NULL_DATE;
|
||||
$howlong = DBA::NULL_DATETIME;
|
||||
} else {
|
||||
$howlong = DateTimeFormat::convert($howlong, 'UTC', date_default_timezone_get());
|
||||
}
|
||||
|
@ -619,7 +619,7 @@ function profiles_content(App $a) {
|
|||
'$gender' => ContactSelector::gender($r[0]['gender']),
|
||||
'$marital' => ['selector' => ContactSelector::maritalStatus($r[0]['marital']), 'value' => $r[0]['marital']],
|
||||
'$with' => ['with', L10n::t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), L10n::t('Examples: cathy123, Cathy Williams, cathy@example.com')],
|
||||
'$howlong' => ['howlong', L10n::t('Since [date]:'), ($r[0]['howlong'] <= NULL_DATE ? '' : DateTimeFormat::local($r[0]['howlong']))],
|
||||
'$howlong' => ['howlong', L10n::t('Since [date]:'), ($r[0]['howlong'] <= DBA::NULL_DATETIME ? '' : DateTimeFormat::local($r[0]['howlong']))],
|
||||
'$sexual' => ['selector' => ContactSelector::sexualPreference($r[0]['sexual']), 'value' => $r[0]['sexual']],
|
||||
'$about' => ['about', L10n::t('Tell us about yourself...'), $r[0]['about']],
|
||||
'$xmpp' => ['xmpp', L10n::t("XMPP \x28Jabber\x29 address:"), $r[0]['xmpp'], L10n::t("The XMPP address will be propagated to your contacts so that they can follow you.")],
|
||||
|
|
|
@ -20,11 +20,10 @@ use Friendica\Model\Contact;
|
|||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Protocol\Email;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\Security;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
function get_theme_config_file($theme)
|
||||
{
|
||||
|
@ -830,7 +829,7 @@ function settings_content(App $a)
|
|||
$mail_pubmail = ((DBA::isResult($r)) ? $r[0]['pubmail'] : 0);
|
||||
$mail_action = ((DBA::isResult($r)) ? $r[0]['action'] : 0);
|
||||
$mail_movetofolder = ((DBA::isResult($r)) ? $r[0]['movetofolder'] : '');
|
||||
$mail_chk = ((DBA::isResult($r)) ? $r[0]['last_check'] : NULL_DATE);
|
||||
$mail_chk = ((DBA::isResult($r)) ? $r[0]['last_check'] : DBA::NULL_DATETIME);
|
||||
|
||||
|
||||
$tpl = get_markup_template('settings/connectors.tpl');
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@ require_once 'include/dba.php';
|
|||
*/
|
||||
class DBA
|
||||
{
|
||||
const NULL_DATE = '0001-01-01';
|
||||
const NULL_DATETIME = '0001-01-01 00:00:00';
|
||||
|
||||
public static $connected = false;
|
||||
|
||||
private static $server_info = '';
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Content\ContactSelector;
|
|||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
|
@ -15,11 +16,10 @@ use Friendica\Core\System;
|
|||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Module\Login;
|
||||
|
||||
/**
|
||||
* Manages and show Contacts and their content
|
||||
|
@ -522,9 +522,9 @@ class Contact extends BaseModule
|
|||
|
||||
$insecure = L10n::t('Private communications are not available for this contact.');
|
||||
|
||||
$last_update = (($contact['last-update'] <= NULL_DATE) ? L10n::t('Never') : DateTimeFormat::local($contact['last-update'], 'D, j M Y, g:i A'));
|
||||
$last_update = (($contact['last-update'] <= DBA::NULL_DATETIME) ? L10n::t('Never') : DateTimeFormat::local($contact['last-update'], 'D, j M Y, g:i A'));
|
||||
|
||||
if ($contact['last-update'] > NULL_DATE) {
|
||||
if ($contact['last-update'] > DBA::NULL_DATETIME) {
|
||||
$last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? L10n::t('(Update was successful)') : L10n::t('(Update was not successful)'));
|
||||
}
|
||||
$lblsuggest = (($contact['network'] === Protocol::DFRN) ? L10n::t('Suggest friends') : '');
|
||||
|
@ -536,7 +536,7 @@ class Contact extends BaseModule
|
|||
// tabs
|
||||
$tab_str = self::getTabsHTML($a, $contact, 3);
|
||||
|
||||
$lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < DateTimeFormat::utcNow()) ? L10n::t('Communications lost with this contact!') : '');
|
||||
$lost_contact = (($contact['archive'] && $contact['term-date'] > DBA::NULL_DATETIME && $contact['term-date'] < DateTimeFormat::utcNow()) ? L10n::t('Communications lost with this contact!') : '');
|
||||
|
||||
$fetch_further_information = null;
|
||||
if ($contact['network'] == Protocol::FEED) {
|
||||
|
|
|
@ -113,7 +113,7 @@ class PortableContact
|
|||
$connect_url = '';
|
||||
$name = '';
|
||||
$network = '';
|
||||
$updated = NULL_DATE;
|
||||
$updated = DBA::NULL_DATETIME;
|
||||
$location = '';
|
||||
$about = '';
|
||||
$keywords = '';
|
||||
|
@ -317,7 +317,7 @@ class PortableContact
|
|||
|
||||
$contact = ["url" => $profile];
|
||||
|
||||
if ($gcontacts[0]["created"] <= NULL_DATE) {
|
||||
if ($gcontacts[0]["created"] <= DBA::NULL_DATETIME) {
|
||||
$contact['created'] = DateTimeFormat::utcNow();
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,7 @@ class PortableContact
|
|||
// Maybe there aren't any entries. Then check if it is a valid feed
|
||||
if ($last_updated == "") {
|
||||
if ($xpath->query('/atom:feed')->length > 0) {
|
||||
$last_updated = NULL_DATE;
|
||||
$last_updated = DBA::NULL_DATETIME;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -931,7 +931,7 @@ class PortableContact
|
|||
|
||||
$gserver = DBA::selectFirst('gserver', [], ['nurl' => normalise_link($server_url)]);
|
||||
if (DBA::isResult($gserver)) {
|
||||
if ($gserver["created"] <= NULL_DATE) {
|
||||
if ($gserver["created"] <= DBA::NULL_DATETIME) {
|
||||
$fields = ['created' => DateTimeFormat::utcNow()];
|
||||
$condition = ['nurl' => normalise_link($server_url)];
|
||||
DBA::update('gserver', $fields, $condition);
|
||||
|
@ -954,12 +954,12 @@ class PortableContact
|
|||
|
||||
// See discussion under https://forum.friendi.ca/display/0b6b25a8135aabc37a5a0f5684081633
|
||||
// It can happen that a zero date is in the database, but storing it again is forbidden.
|
||||
if ($last_contact < NULL_DATE) {
|
||||
$last_contact = NULL_DATE;
|
||||
if ($last_contact < DBA::NULL_DATETIME) {
|
||||
$last_contact = DBA::NULL_DATETIME;
|
||||
}
|
||||
|
||||
if ($last_failure < NULL_DATE) {
|
||||
$last_failure = NULL_DATE;
|
||||
if ($last_failure < DBA::NULL_DATETIME) {
|
||||
$last_failure = DBA::NULL_DATETIME;
|
||||
}
|
||||
|
||||
if (!$force && !self::updateNeeded($gserver["created"], "", $last_failure, $last_contact)) {
|
||||
|
@ -976,8 +976,8 @@ class PortableContact
|
|||
$register_policy = -1;
|
||||
$registered_users = 0;
|
||||
|
||||
$last_contact = NULL_DATE;
|
||||
$last_failure = NULL_DATE;
|
||||
$last_contact = DBA::NULL_DATETIME;
|
||||
$last_failure = DBA::NULL_DATETIME;
|
||||
}
|
||||
logger("Server ".$server_url." is outdated or unknown. Start discovery. Force: ".$force." Created: ".$gserver["created"]." Failure: ".$last_failure." Contact: ".$last_contact, LOGGER_DEBUG);
|
||||
|
||||
|
@ -1794,7 +1794,7 @@ class PortableContact
|
|||
$connect_url = '';
|
||||
$name = '';
|
||||
$network = '';
|
||||
$updated = NULL_DATE;
|
||||
$updated = DBA::NULL_DATETIME;
|
||||
$location = '';
|
||||
$about = '';
|
||||
$keywords = '';
|
||||
|
|
|
@ -11,6 +11,7 @@ use DateTimeZone;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
require_once 'boot.php';
|
||||
require_once 'include/text.php';
|
||||
|
@ -290,7 +291,7 @@ class Temporal
|
|||
|
||||
$abs = strtotime($localtime);
|
||||
|
||||
if (is_null($posted_date) || $posted_date <= NULL_DATE || $abs === false) {
|
||||
if (is_null($posted_date) || $posted_date <= DBA::NULL_DATETIME || $abs === false) {
|
||||
return L10n::t('never');
|
||||
}
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ class Cron
|
|||
foreach ($contacts as $contact) {
|
||||
|
||||
if ($manual_id) {
|
||||
$contact['last-update'] = NULL_DATE;
|
||||
$contact['last-update'] = DBA::NULL_DATETIME;
|
||||
}
|
||||
|
||||
// Friendica and OStatus are checked once a day
|
||||
|
|
|
@ -108,7 +108,7 @@ class CronJobs
|
|||
private static function expireAndRemoveUsers()
|
||||
{
|
||||
// expire any expired regular accounts. Don't expire forums.
|
||||
$condition = ["NOT `account_expired` AND `account_expires_on` > ? AND `account_expires_on` < UTC_TIMESTAMP() AND `page-flags` = 0", NULL_DATE];
|
||||
$condition = ["NOT `account_expired` AND `account_expires_on` > ? AND `account_expires_on` < UTC_TIMESTAMP() AND `page-flags` = 0", DBA::NULL_DATETIME];
|
||||
DBA::update('user', ['account_expired' => true], $condition);
|
||||
|
||||
// Remove any freshly expired account
|
||||
|
|
|
@ -12,8 +12,8 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Protocol\Email;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Protocol\Email;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -121,7 +121,7 @@ class OnePoll
|
|||
$hub_update = false;
|
||||
}
|
||||
|
||||
$last_update = (($contact['last-update'] <= NULL_DATE)
|
||||
$last_update = (($contact['last-update'] <= DBA::NULL_DATETIME)
|
||||
? DateTimeFormat::utc('now - 7 days', DateTimeFormat::ATOM)
|
||||
: DateTimeFormat::utc($contact['last-update'], DateTimeFormat::ATOM)
|
||||
);
|
||||
|
@ -252,7 +252,7 @@ class OnePoll
|
|||
self::updateContact($contact, $fields);
|
||||
|
||||
Contact::markForArchival($contact);
|
||||
} elseif ($contact['term-date'] > NULL_DATE) {
|
||||
} elseif ($contact['term-date'] > DBA::NULL_DATETIME) {
|
||||
logger("$url back from the dead - removing mark for death");
|
||||
Contact::unmarkForArchival($contact);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue