]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/Feed.php
Fix variable assignment alignment in Module\Admin\Site
[friendica.git] / src / Protocol / Feed.php
index a1b77f8bd5e4628e9c05f8f0039f87446b44d77f..07fa04518a3bdcbc95c917d68b5d0fd7e5a3c1fe 100644 (file)
@@ -42,6 +42,7 @@ use Friendica\Util\ParseUrl;
 use Friendica\Util\Proxy;
 use Friendica\Util\Strings;
 use Friendica\Util\XML;
+use GuzzleHttp\Exception\TransferException;
 
 /**
  * This class contain functions to import feeds (RSS/RDF/Atom)
@@ -297,7 +298,11 @@ class Feed
 
                        $orig_plink = $item["plink"];
 
-                       $item["plink"] = DI::httpRequest()->finalUrl($item["plink"]);
+                       try {
+                               $item["plink"] = DI::httpClient()->finalUrl($item["plink"]);
+                       } catch (TransferException $exception) {
+                               Logger::notice('Item URL couldn\'t get expanded', ['url' => $item["plink"], 'exception' => $exception]);
+                       }
 
                        $item["title"] = XML::getFirstNodeValue($xpath, 'atom:title/text()', $entry);
 
@@ -601,7 +606,9 @@ class Feed
                                }
                                $publish_at = date(DateTimeFormat::MYSQL, $publish_time);
 
-                               Post\Delayed::add($posting['item']['uri'], $posting['item'], $posting['notify'], false, $publish_at, $posting['taglist'], $posting['attachments']);
+                               if (Post\Delayed::add($posting['item']['uri'], $posting['item'], $posting['notify'], Post\Delayed::PREPARED, $publish_at, $posting['taglist'], $posting['attachments'])) {
+                                       DI::pConfig()->set($item['uid'], 'system', 'last_publish', $publish_time);
+                               }
                        }
                }