]> git.mxchange.org Git - friendica.git/commitdiff
Move NULL_DATE from boot.php to DBA::NULL_DATETIME
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 21 Oct 2018 05:53:47 +0000 (01:53 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 22 Oct 2018 20:50:55 +0000 (16:50 -0400)
- Add DBA::NULL_DATE constant

19 files changed:
boot.php
mod/events.php
mod/profiles.php
mod/settings.php
src/Core/Authentication.php
src/Core/UserImport.php
src/Core/Worker.php
src/Database/DBA.php
src/Model/Contact.php
src/Model/Event.php
src/Model/GContact.php
src/Model/Profile.php
src/Model/PushSubscriber.php
src/Module/Contact.php
src/Protocol/PortableContact.php
src/Util/Temporal.php
src/Worker/Cron.php
src/Worker/CronJobs.php
src/Worker/OnePoll.php

index 91f62c4b4fb32731e84ecb266414c90bc6e2f0ad..a1154cf75691c676414210ef7178a054de9da17f 100644 (file)
--- a/boot.php
+++ b/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);
index 7cdeb85f71985d17c3c47469112710974c61b3fc..81ab79c722e09c895ea752608bc33a94df0f7e3a 100644 (file)
@@ -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.');
index 734b5f19ee8ba0d31ae6a9aeb6e799f19d411ab5..a4a49ec785ad1b4e5dfda67a1430bff5adfec849 100644 (file)
@@ -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.")],
index 970c5b7ee469d905833154acd350423bee1af780..52c5f42cf08bb3c59420a515a2199fcfb7f8626c 100644 (file)
@@ -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');
index 76d078341f74c0658391f8a53e20fb1950e300a7..5371cc91ecb42e23d3b9e372d30819c615b35812 100644 (file)
@@ -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);
index 54f3ec06157ce32eb5c12f9a3e047012da61c29a..18aabec08a07c800be2b7d74195a36fd5ff867b3 100644 (file)
@@ -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:
index 723cd809da44d3230721afd1eb4e06cf5a17ffb7..a06a11043daf16752701e5acff4a585cc2ea5208 100644 (file)
@@ -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]);
        }
 
index 8fd117e5d2c56f742b399dcf93d8ea2988218317..9baf409421ed917e48d62e5dc4c7ae8ac681b111 100644 (file)
@@ -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 = '';
index 1a5c97834ad35e8eed0f2bcf5a30fb242602ddec..3524cd4ce10eff1fb7ac30c04f38948d337256e7 100644 (file)
@@ -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'])]);
 
index 452017e69d3a04bcfbd2269d851b1db69340f9ee..e9a4d4b3fd7d1792f5f44e3bb1c1208dc3f6a85e 100644 (file)
@@ -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));
 
index 681c1c37096473fa96679edbb402086591222a67..20e6f0751ed8867d7eacb76998107d42481ee248 100644 (file)
@@ -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)
index 4de49022cb1fd0bf8743e3fbdb9c7e4be4c38959..53b98fb625ab636b6ae1bdc479663437c84b8876 100644 (file)
@@ -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'));
                        }
 
index 9680d359d09637c1007a302b46f3d36d221b4827..e024878a5821d7f33d6777ec581501e3ba5d2abb 100644 (file)
@@ -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);
        }
index 271740a4f5d28eddec6ffba15ae6883a4ef423e7..fb0bf0edeeab4341cd84b67a0a74c8ba88104264 100644 (file)
@@ -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) {
index 0e4d58d1c19348f67aa2af88510bcd2aa265c908..bb7ccd564aa166bf8b08f7405b6d60d56bc82299 100644 (file)
@@ -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 = '';
index 0cc759da140c2fd3556eba00a352d7b9cc2ad76a..bc7639b3b740f102b2f6b32e162413c1e961f7ca 100644 (file)
@@ -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');
                }
 
index 54e6cb676eb1bbea1927591b58a6270560cdf17f..9510063337f5da31756ed3a5c1613976c7256a28 100644 (file)
@@ -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
index bd34449729392f575ad53169dc1750cb590ce5ad..a564bd0b0d19cca39f6bc0d010bbe145b2d304b8 100644 (file)
@@ -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
index be6d5a549ebc6709a5f94ea5e8c95e8e35a892c9..5227c7983d58f98433ee046d6c4d7108bae17428 100644 (file)
@@ -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);
                        }