]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/Feed.php
Merge branch '2018.08-rc'
[friendica.git] / src / Protocol / Feed.php
index 7bae9ef588894e6f7e467e7d823818933a33914a..0709a9550ea23b44c20468930c1d30369f1b65ea 100644 (file)
@@ -9,6 +9,7 @@ namespace Friendica\Protocol;
 use DOMDocument;
 use DOMXPath;
 use Friendica\Content\Text\HTML;
+use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Model\Item;
@@ -187,7 +188,7 @@ class Feed {
 
                $header = [];
                $header["uid"] = $importer["uid"];
-               $header["network"] = NETWORK_FEED;
+               $header["network"] = Protocol::FEED;
                $header["wall"] = 0;
                $header["origin"] = 0;
                $header["gravity"] = GRAVITY_PARENT;
@@ -244,7 +245,7 @@ class Feed {
 
                        if (!$simulate) {
                                $condition = ["`uid` = ? AND `uri` = ? AND `network` IN (?, ?)",
-                                       $importer["uid"], $item["uri"], NETWORK_FEED, NETWORK_DFRN];
+                                       $importer["uid"], $item["uri"], Protocol::FEED, Protocol::DFRN];
                                $previous = Item::selectFirst(['id'], $condition);
                                if (DBA::isResult($previous)) {
                                        logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG);
@@ -270,9 +271,14 @@ class Feed {
                        }
                        $updated = XML::getFirstNodeValue($xpath, 'atom:updated/text()', $entry);
 
-                       if (empty($updated)) {
+                       if (empty($updated) && !empty($published)) {
                                $updated = $published;
                        }
+
+                       if (empty($published) && !empty($updated)) {
+                               $published = $updated;
+                       }
+
                        if ($published != "") {
                                $item["created"] = $published;
                        }