X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FFeed.php;h=0709a9550ea23b44c20468930c1d30369f1b65ea;hb=cbfc3d0c28e0b55c3ccf1ddfd321798a8c2532e8;hp=a68a2bd67e7b930040c6b4625f82e68fde154ef2;hpb=0360f7197aac062eb2fecf95969658ca56068deb;p=friendica.git diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index a68a2bd67e..0709a9550e 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -6,17 +6,16 @@ */ namespace Friendica\Protocol; -use Friendica\Database\DBM; +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; use Friendica\Util\Network; -use Friendica\Content\Text\HTML; use Friendica\Util\XML; -use dba; -use DOMDocument; -use DOMXPath; - require_once 'include/dba.php'; require_once 'include/items.php'; @@ -189,8 +188,7 @@ class Feed { $header = []; $header["uid"] = $importer["uid"]; - $header["network"] = NETWORK_FEED; - $header["type"] = "remote"; + $header["network"] = Protocol::FEED; $header["wall"] = 0; $header["origin"] = 0; $header["gravity"] = GRAVITY_PARENT; @@ -247,9 +245,9 @@ 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 (DBM::is_result($previous)) { + if (DBA::isResult($previous)) { logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG); continue; } @@ -273,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; }