]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #4387 from MrPetovan/task/3878-move-datetime-to-src
authorMichael Vogel <icarus@dabo.de>
Sun, 4 Feb 2018 20:05:27 +0000 (21:05 +0100)
committerGitHub <noreply@github.com>
Sun, 4 Feb 2018 20:05:27 +0000 (21:05 +0100)
Move include/datetime to src/ - Part 2

doc/htconfig.md
include/text.php
src/Core/UserImport.php
src/Database/DBM.php
src/Protocol/PortableContact.php
util/credits.txt

index 8a98dc1039a2b8c930869696c858babe9c0d9a43..e09c37b74d196ae1423f4d41fabb8b1ea55f5c90 100644 (file)
@@ -41,6 +41,7 @@ Example: To set the automatic database cleanup process add this line to your .ht
 * **disable_email_validation** (Boolean) - Disables the check if a mail address is in a valid format and can be resolved via DNS.
 * **disable_url_validation** (Boolean) - Disables the DNS lookup of an URL.
 * **dlogfile - location of the developer log file
+* **dlogip - restricts develop log writes to requests originating from this IP address
 * **frontend_worker_timeout** - Value in minutes after we think that a frontend task was killed by the webserver. Default value is 10.
 * **hsts** (Boolean) - Enables the sending of HTTP Strict Transport Security headers
 * **ignore_cache** (Boolean) - For development only. Disables the item cache.
index dc604124fd4bb8fbab371d7035447809ab026a03..26b153549f3909206ff0aaae470913c4ed01bd51 100644 (file)
@@ -737,12 +737,16 @@ function dlogger($msg, $level = 0) {
                return;
        }
 
-       $logfile = Config::get('system','dlogfile');
-
+       $logfile = Config::get('system', 'dlogfile');
        if (! $logfile) {
                return;
        }
 
+       $dlogip = Config::get('system', 'dlogip');
+       if (!is_null($dlogip) && $_SERVER['REMOTE_ADDR'] != $dlogip) {
+               return;
+       }
+
        if (count($LOGGER_LEVELS) == 0) {
                foreach (get_defined_constants() as $k => $v) {
                        if (substr($k, 0, 7) == "LOGGER_") {
index 582f4d0c3b429a326cabfea7c565eb456c30b9ad..ec6e6bb86c158b546005ef7dae3ecb9c0ea7df3e 100644 (file)
@@ -173,9 +173,6 @@ class UserImport
 
                PConfig::set($newuid, 'system', 'previous_addr', $old_handle);
 
-               // Generate a new guid for the account. Otherwise there will be problems with diaspora
-               dba::update('user', ['guid' => generate_user_guid()], ['uid' => $newuid]);
-
                foreach ($account['profile'] as &$profile) {
                        foreach ($profile as $k => &$v) {
                                $v = str_replace([$oldbaseurl, $oldaddr], [$newbaseurl, $newaddr], $v);
index 6f14c12b8c51af9d878597f51a0e3d4228926851..7daf6b545f0c972a91db565d8d633011b262ab15 100644 (file)
@@ -114,19 +114,13 @@ class DBM
        /**
         * Checks Converts any date string into a SQL compatible date string
         *
+        * @deprecated since version 3.6
         * @param string $date a date string in any format
         *
         * @return string SQL style date string
         */
        public static function date($date = 'now')
        {
-               $timestamp = strtotime($date);
-
-               // Don't allow lower date strings as '0001-01-01 00:00:00'
-               if ($timestamp < -62135596800) {
-                       $timestamp = -62135596800;
-               }
-
-               return date(DateTimeFormat::MYSQL, (int)$timestamp);
+               return DateTimeFormat::utc($date);
        }
 }
index 7c1015c9aa526dbef411e29a9b71748fa73c0690..201f9c8c048b799078ab1dcc036ca53fbfd6f09a 100644 (file)
@@ -501,14 +501,16 @@ class PortableContact
                $last_updated = "";
 
                foreach ($entries as $entry) {
-                       $published = $xpath->query('atom:published/text()', $entry)->item(0)->nodeValue;
-                       $updated = $xpath->query('atom:updated/text()', $entry)->item(0)->nodeValue;
+                       $published = DateTimeFormat::utc($xpath->query('atom:published/text()', $entry)->item(0)->nodeValue);
+                       $updated   = DateTimeFormat::utc($xpath->query('atom:updated/text()'  , $entry)->item(0)->nodeValue);
 
-                       if ($last_updated < $published)
+                       if ($last_updated < $published) {
                                $last_updated = $published;
+                       }
 
-                       if ($last_updated < $updated)
+                       if ($last_updated < $updated) {
                                $last_updated = $updated;
+                       }
                }
 
                // Maybe there aren't any entries. Then check if it is a valid feed
@@ -517,7 +519,8 @@ class PortableContact
                                $last_updated = NULL_DATE;
                        }
                }
-               $fields = ['updated' => DBM::date($last_updated), 'last_contact' => DBM::date()];
+
+               $fields = ['updated' => $last_updated, 'last_contact' => DateTimeFormat::utcNow()];
                dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
 
                if (($gcontacts[0]["generation"] == 0)) {
@@ -527,7 +530,7 @@ class PortableContact
 
                logger("Profile ".$profile." was last updated at ".$last_updated, LOGGER_DEBUG);
 
-               return($last_updated);
+               return $last_updated;
        }
 
        public static function updateNeeded($created, $updated, $last_failure, $last_contact)
index 0dd8aa95f1a8b2defb2f6c8dc370cd543dec68a4..4753c6a5d2eec773aaf3438a0171ddc3d477cfcd 100644 (file)
@@ -178,6 +178,7 @@ szymon.filip
 Sérgio Lima
 Taekus
 Tazman DeVille
+Thecross
 Thomas
 Thomas Willingham
 thorsten23