]> git.mxchange.org Git - friendica.git/commitdiff
Use DateTimeFormat::utc() instead of DBM::date()
authorHypolite Petovan <mrpetovan@gmail.com>
Sat, 21 Jul 2018 12:25:11 +0000 (08:25 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 23 Jul 2018 14:57:47 +0000 (10:57 -0400)
mod/network.php
src/Database/DBStructure.php
src/Model/Conversation.php
src/Model/GContact.php
src/Network/Probe.php
src/Protocol/DFRN.php
update.php

index 50eb025c23b0af2d5b3a19e4e8e68c5892ad4f4f..18c2037dda2ad773449c87a0bef452d40ed230ea 100644 (file)
@@ -480,9 +480,9 @@ function networkThreadedView(App $a, $update, $parent)
        $rawmode = (isset($_GET['mode']) AND ( $_GET['mode'] == 'raw'));
 
        if (isset($_GET['last_received']) && isset($_GET['last_commented']) && isset($_GET['last_created']) && isset($_GET['last_id'])) {
-               $last_received = DBM::date($_GET['last_received']);
-               $last_commented = DBM::date($_GET['last_commented']);
-               $last_created = DBM::date($_GET['last_created']);
+               $last_received = DateTimeFormat::utc($_GET['last_received']);
+               $last_commented = DateTimeFormat::utc($_GET['last_commented']);
+               $last_created = DateTimeFormat::utc($_GET['last_created']);
                $last_id = intval($_GET['last_id']);
        } else {
                $last_received = '';
index cb2ba08a14b83498561274a5cdd34945ec77bb97..708a20b45bb98b0f3146843aec5f8dda8045b812 100644 (file)
@@ -8,6 +8,7 @@ use Exception;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
+use Friendica\Util\DateTimeFormat;
 
 require_once 'boot.php';
 require_once 'include/dba.php';
@@ -207,7 +208,7 @@ class DBStructure
        public static function update($verbose, $action, $install = false, array $tables = null, array $definition = null) {
                if ($action && !$install) {
                        Config::set('system', 'maintenance', 1);
-                       Config::set('system', 'maintenance_reason', L10n::t('%s: Database update', DBM::date().' '.date('e')));
+                       Config::set('system', 'maintenance_reason', L10n::t('%s: Database update', DateTimeFormat::utcNow().' '.date('e')));
                }
 
                $errors = '';
@@ -469,7 +470,7 @@ class DBStructure
 
                                if ($action) {
                                        if (!$install) {
-                                               Config::set('system', 'maintenance_reason', L10n::t('%s: updating %s table.', DBM::date().' '.date('e'), $name));
+                                               Config::set('system', 'maintenance_reason', L10n::t('%s: updating %s table.', DateTimeFormat::utcNow().' '.date('e'), $name));
                                        }
 
                                        // Ensure index conversion to unique removes duplicates
index 8ad26c898dd89c801c6fbd0f3f76344c7bedc40b..3113d53890ee8623360fceade75bb49ef65b9374 100644 (file)
@@ -6,6 +6,7 @@ namespace Friendica\Model;
 
 use Friendica\Database\DBA;
 use Friendica\Database\DBM;
+use Friendica\Util\DateTimeFormat;
 
 require_once "include/dba.php";
 
@@ -27,7 +28,7 @@ class Conversation
         */
        public static function insert($arr) {
                if (in_array(defaults($arr, 'network', NETWORK_PHANTOM), [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]) && !empty($arr['uri'])) {
-                       $conversation = ['item-uri' => $arr['uri'], 'received' => DBM::date()];
+                       $conversation = ['item-uri' => $arr['uri'], 'received' => DateTimeFormat::utcNow()];
 
                        if (isset($arr['parent-uri']) && ($arr['parent-uri'] != $arr['uri'])) {
                                $conversation['reply-to-uri'] = $arr['parent-uri'];
index 8dbc37c22860adc6454277be4528d85713666c0f..6a6f6cd349cc9ed86d7917e267f7a0bb76f7c8ee 100644 (file)
@@ -815,7 +815,7 @@ class GContact
                self::fixAlternateContactAddress($contact);
 
                if (!isset($contact["updated"])) {
-                       $contact["updated"] = DBM::date();
+                       $contact["updated"] = DateTimeFormat::utcNow();
                }
 
                if ($contact["network"] == NETWORK_TWITTER) {
@@ -858,7 +858,7 @@ class GContact
                        logger("Update gcontact for ".$contact["url"], LOGGER_DEBUG);
                        $condition = ['`nurl` = ? AND (`generation` = 0 OR `generation` >= ?)',
                                        normalise_link($contact["url"]), $contact["generation"]];
-                       $contact["updated"] = DBM::date($contact["updated"]);
+                       $contact["updated"] = DateTimeFormat::utc($contact["updated"]);
 
                        $updated = ['photo' => $contact['photo'], 'name' => $contact['name'],
                                        'nick' => $contact['nick'], 'addr' => $contact['addr'],
index c01e3edd415ee0685603d9e5bfdecb1d322892c0..71d36ea8ff57218a32a55d9e81be0c9ce4c3b109 100644 (file)
@@ -411,7 +411,7 @@ class Probe
                                        }
                                }
 
-                               $fields['updated'] = DBM::date();
+                               $fields['updated'] = DateTimeFormat::utcNow();
 
                                $condition = ['nurl' => normalise_link($data["url"])];
 
index 248203f387d8b057e0b362bcd601602ea7e0407f..3bcb6a77b3b6ef924f3323926a72ee8e0bf8cfaa 100644 (file)
@@ -1748,7 +1748,7 @@ class DFRN
                                        dbesc($contact["name"]), dbesc($contact["nick"]), dbesc($contact["about"]),     dbesc($contact["location"]),
                                        dbesc($contact["addr"]), dbesc($contact["keywords"]), dbesc($contact["bdyear"]),
                                        dbesc($contact["bd"]), intval($contact["hidden"]), dbesc($contact["xmpp"]),
-                                       dbesc(DBM::date($contact["name-date"])), dbesc(DBM::date($contact["uri-date"])),
+                                       dbesc(DateTimeFormat::utc($contact["name-date"])), dbesc(DateTimeFormat::utc($contact["uri-date"])),
                                        intval($contact["id"]), dbesc($contact["network"])
                                );
                        }
index ee70a7a262448ddd152923c7ff5b60c790278820..e7543728d2f6d25178a02a9103a2847fd5b641fe 100644 (file)
@@ -10,6 +10,7 @@ use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
 use Friendica\Model\User;
+use Friendica\Util\DateTimeFormat;
 
 require_once 'include/dba.php';
 
@@ -191,7 +192,7 @@ WHERE `hook` LIKE 'plugin_%'");
 
 function update_1260() {
        Config::set('system', 'maintenance', 1);
-       Config::set('system', 'maintenance_reason', L10n::t('%s: Updating author-id and owner-id in item and thread table. ', DBM::date().' '.date('e')));
+       Config::set('system', 'maintenance_reason', L10n::t('%s: Updating author-id and owner-id in item and thread table. ', DateTimeFormat::utcNow().' '.date('e')));
 
        $items = DBA::p("SELECT `id`, `owner-link`, `owner-name`, `owner-avatar`, `network` FROM `item`
                WHERE `owner-id` = 0 AND `owner-link` != ''");
@@ -237,7 +238,7 @@ function update_1261() {
 
 function update_1278() {
        Config::set('system', 'maintenance', 1);
-       Config::set('system', 'maintenance_reason', L10n::t('%s: Updating post-type.', DBM::date().' '.date('e')));
+       Config::set('system', 'maintenance_reason', L10n::t('%s: Updating post-type.', DateTimeFormat::utcNow().' '.date('e')));
 
        Item::update(['post-type' => Item::PT_PAGE], ['bookmark' => true]);
        Item::update(['post-type' => Item::PT_PERSONAL_NOTE], ['type' => 'note']);