]> git.mxchange.org Git - friendica.git/commitdiff
Use DateTimeFormat::utc on Atom feed dates
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 4 Feb 2018 02:39:35 +0000 (21:39 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Sun, 4 Feb 2018 02:39:35 +0000 (21:39 -0500)
- Fix some formatting in Protocol\PortableContact

src/Protocol/PortableContact.php

index 7f351ed059226f980e01462828753c38e0beed64..8d51a89693a764697b8bdd3c78630144a0ef3759 100644 (file)
@@ -502,14 +502,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
@@ -518,7 +520,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)) {
@@ -528,7 +531,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)