X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FImportBundle%2FImport%2FPocketImport.php;h=678d016a8bd11fcdcc178a4a9527924d43be0d5b;hb=8642f14220a834a434225d812e2ea07680b04cb2;hp=ac68b6d92b66396f21979a09ca6273d7bb5e6895;hpb=dc12084d933dc4981a6ff489622845053d4914b3;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index ac68b6d9..678d016a 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php @@ -2,7 +2,6 @@ namespace Wallabag\ImportBundle\Import; -use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use Doctrine\ORM\EntityManager; use GuzzleHttp\Client; @@ -12,12 +11,9 @@ use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Helper\ContentProxy; use Craue\ConfigBundle\Util\Config; -class PocketImport implements ImportInterface +class PocketImport extends AbstractImport { private $user; - private $em; - private $contentProxy; - private $logger; private $client; private $consumerKey; private $skippedEntries = 0; @@ -34,11 +30,6 @@ class PocketImport implements ImportInterface $this->logger = new NullLogger(); } - public function setLogger(LoggerInterface $logger) - { - $this->logger = $logger; - } - /** * {@inheritdoc} */ @@ -219,7 +210,13 @@ class PocketImport implements ImportInterface } $entry = new Entry($this->user); - $entry = $this->contentProxy->updateEntry($entry, $url); + $entry = $this->fetchContent($entry, $url); + + // jump to next entry in case of problem while getting content + if (false === $entry) { + ++$this->skippedEntries; + continue; + } // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted if ($pocketEntry['status'] == 1 || $this->markAsRead) { @@ -258,7 +255,7 @@ class PocketImport implements ImportInterface // flush every 20 entries if (($i % 20) === 0) { $this->em->flush(); - $this->em->clear(); + $this->em->clear($entry); } ++$i; }