From 7975395d10bb381de8cd15b5ee15198318af6d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Viande?= Date: Wed, 11 Apr 2018 11:42:52 +0200 Subject: Entry: add archived_at property and updateArchived method --- src/Wallabag/ImportBundle/Import/BrowserImport.php | 2 +- src/Wallabag/ImportBundle/Import/InstapaperImport.php | 2 +- src/Wallabag/ImportBundle/Import/PinboardImport.php | 2 +- src/Wallabag/ImportBundle/Import/PocketImport.php | 2 +- src/Wallabag/ImportBundle/Import/ReadabilityImport.php | 2 +- src/Wallabag/ImportBundle/Import/WallabagImport.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Wallabag/ImportBundle/Import') diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index 225f1791..614386cb 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php @@ -133,7 +133,7 @@ abstract class BrowserImport extends AbstractImport ); } - $entry->setArchived($data['is_archived']); + $entry->updateArchived($data['is_archived']); if (!empty($data['created_at'])) { $dt = new \DateTime(); diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index e4f0970c..e113ba00 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -135,7 +135,7 @@ class InstapaperImport extends AbstractImport ); } - $entry->setArchived($importedEntry['is_archived']); + $entry->updateArchived($importedEntry['is_archived']); $entry->setStarred($importedEntry['is_starred']); $this->em->persist($entry); diff --git a/src/Wallabag/ImportBundle/Import/PinboardImport.php b/src/Wallabag/ImportBundle/Import/PinboardImport.php index 110b0464..9a5e8cb6 100644 --- a/src/Wallabag/ImportBundle/Import/PinboardImport.php +++ b/src/Wallabag/ImportBundle/Import/PinboardImport.php @@ -119,7 +119,7 @@ class PinboardImport extends AbstractImport ); } - $entry->setArchived($data['is_archived']); + $entry->updateArchived($data['is_archived']); $entry->setStarred($data['is_starred']); $entry->setCreatedAt(new \DateTime($data['created_at'])); diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index c1b35b7e..4b1ad1d7 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php @@ -194,7 +194,7 @@ class PocketImport extends AbstractImport $this->fetchContent($entry, $url); // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted - $entry->setArchived(1 === $importedEntry['status'] || $this->markAsRead); + $entry->updateArchived(1 === $importedEntry['status'] || $this->markAsRead); // 0 or 1 - 1 If the item is starred $entry->setStarred(1 === $importedEntry['favorite']); diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php index 002b27f4..d6777582 100644 --- a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php +++ b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php @@ -111,7 +111,7 @@ class ReadabilityImport extends AbstractImport // update entry with content (in case fetching failed, the given entry will be return) $this->fetchContent($entry, $data['url'], $data); - $entry->setArchived($data['is_archived']); + $entry->updateArchived($data['is_archived']); $entry->setStarred($data['is_starred']); $entry->setCreatedAt(new \DateTime($data['created_at'])); diff --git a/src/Wallabag/ImportBundle/Import/WallabagImport.php b/src/Wallabag/ImportBundle/Import/WallabagImport.php index c64ccd64..916137f1 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagImport.php +++ b/src/Wallabag/ImportBundle/Import/WallabagImport.php @@ -122,7 +122,7 @@ abstract class WallabagImport extends AbstractImport $entry->setPreviewPicture($importedEntry['preview_picture']); } - $entry->setArchived($data['is_archived']); + $entry->updateArchived($data['is_archived']); $entry->setStarred($data['is_starred']); if (!empty($data['created_at'])) { -- cgit v1.2.3 From 3afc87426dade0eaeccf69d144a119c6f0c4534f Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 15 Jan 2019 09:49:22 +0100 Subject: CS --- src/Wallabag/ImportBundle/Import/InstapaperImport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/ImportBundle/Import') diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index df1d6666..44c034f8 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -62,7 +62,7 @@ class InstapaperImport extends AbstractImport } $entries = []; - $handle = fopen($this->filepath, 'rb'); + $handle = fopen($this->filepath, 'r'); while (false !== ($data = fgetcsv($handle, 10240))) { if ('URL' === $data[0]) { continue; -- cgit v1.2.3 From 2491c50b6bbb4d51696ad64aa754c1cd0fc83d1b Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 19 Jan 2019 22:24:52 +0100 Subject: Fix status from Instapaper That status was used as `http_status` in ContentProxy->stockEntry --- src/Wallabag/ImportBundle/Import/InstapaperImport.php | 1 - 1 file changed, 1 deletion(-) (limited to 'src/Wallabag/ImportBundle/Import') diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 44c034f8..439c978c 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -79,7 +79,6 @@ class InstapaperImport extends AbstractImport $entries[] = [ 'url' => $data[0], 'title' => $data[1], - 'status' => $data[3], 'is_archived' => 'Archive' === $data[3] || 'Starred' === $data[3], 'is_starred' => 'Starred' === $data[3], 'html' => false, -- cgit v1.2.3 From 3784688a88230d9c3aec4ca518be52ea1c70aeb9 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 12 Jan 2019 13:09:36 +0100 Subject: Replace continue; with break; to avoid PHP 7.3 warnings Signed-off-by: Thomas Citharel --- src/Wallabag/ImportBundle/Import/AbstractImport.php | 2 +- src/Wallabag/ImportBundle/Import/BrowserImport.php | 6 +++--- src/Wallabag/ImportBundle/Import/InstapaperImport.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Wallabag/ImportBundle/Import') diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php index d39d71b6..5ae4aa8d 100644 --- a/src/Wallabag/ImportBundle/Import/AbstractImport.php +++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php @@ -169,7 +169,7 @@ abstract class AbstractImport implements ImportInterface $entry = $this->parseEntry($importedEntry); if (null === $entry) { - continue; + break; } // store each entry to be flushed so we can trigger the entry.saved event for each of them diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index 804bc6cd..178ebe8e 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php @@ -158,13 +158,13 @@ abstract class BrowserImport extends AbstractImport foreach ($entries as $importedEntry) { if ((array) $importedEntry !== $importedEntry) { - continue; + break; } $entry = $this->parseEntry($importedEntry); if (null === $entry) { - continue; + break; } // @see AbstractImport @@ -206,7 +206,7 @@ abstract class BrowserImport extends AbstractImport { foreach ($entries as $importedEntry) { if ((array) $importedEntry !== $importedEntry) { - continue; + break; } // set userId for the producer (it won't know which user is connected) diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 439c978c..6b6b35af 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -65,7 +65,7 @@ class InstapaperImport extends AbstractImport $handle = fopen($this->filepath, 'r'); while (false !== ($data = fgetcsv($handle, 10240))) { if ('URL' === $data[0]) { - continue; + break; } // last element in the csv is the folder where the content belong -- cgit v1.2.3 From ea925bb112ab99efbb29d8e7113e80357a70bd18 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 27 Feb 2019 14:33:26 +0100 Subject: CS --- src/Wallabag/ImportBundle/Import/BrowserImport.php | 10 +++++----- src/Wallabag/ImportBundle/Import/ChromeImport.php | 2 +- src/Wallabag/ImportBundle/Import/FirefoxImport.php | 2 +- src/Wallabag/ImportBundle/Import/WallabagImport.php | 2 +- src/Wallabag/ImportBundle/Import/WallabagV1Import.php | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/Wallabag/ImportBundle/Import') diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index 178ebe8e..99717beb 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php @@ -77,7 +77,7 @@ abstract class BrowserImport extends AbstractImport */ public function parseEntry(array $importedEntry) { - if ((!array_key_exists('guid', $importedEntry) || (!array_key_exists('id', $importedEntry))) && \is_array(reset($importedEntry))) { + if ((!\array_key_exists('guid', $importedEntry) || (!\array_key_exists('id', $importedEntry))) && \is_array(reset($importedEntry))) { if ($this->producer) { $this->parseEntriesForProducer($importedEntry); @@ -89,7 +89,7 @@ abstract class BrowserImport extends AbstractImport return; } - if (array_key_exists('children', $importedEntry)) { + if (\array_key_exists('children', $importedEntry)) { if ($this->producer) { $this->parseEntriesForProducer($importedEntry['children']); @@ -101,11 +101,11 @@ abstract class BrowserImport extends AbstractImport return; } - if (!array_key_exists('uri', $importedEntry) && !array_key_exists('url', $importedEntry)) { + if (!\array_key_exists('uri', $importedEntry) && !\array_key_exists('url', $importedEntry)) { return; } - $url = array_key_exists('uri', $importedEntry) ? $importedEntry['uri'] : $importedEntry['url']; + $url = \array_key_exists('uri', $importedEntry) ? $importedEntry['uri'] : $importedEntry['url']; $existingEntry = $this->em ->getRepository('WallabagCoreBundle:Entry') @@ -126,7 +126,7 @@ abstract class BrowserImport extends AbstractImport // update entry with content (in case fetching failed, the given entry will be return) $this->fetchContent($entry, $data['url'], $data); - if (array_key_exists('tags', $data)) { + if (\array_key_exists('tags', $data)) { $this->tagsAssigner->assignTagsToEntry( $entry, $data['tags'] diff --git a/src/Wallabag/ImportBundle/Import/ChromeImport.php b/src/Wallabag/ImportBundle/Import/ChromeImport.php index eccee698..4ae82ade 100644 --- a/src/Wallabag/ImportBundle/Import/ChromeImport.php +++ b/src/Wallabag/ImportBundle/Import/ChromeImport.php @@ -57,7 +57,7 @@ class ChromeImport extends BrowserImport 'created_at' => substr($entry['date_added'], 0, 10), ]; - if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { + if (\array_key_exists('tags', $entry) && '' !== $entry['tags']) { $data['tags'] = $entry['tags']; } diff --git a/src/Wallabag/ImportBundle/Import/FirefoxImport.php b/src/Wallabag/ImportBundle/Import/FirefoxImport.php index 8999e3f3..b3558f21 100644 --- a/src/Wallabag/ImportBundle/Import/FirefoxImport.php +++ b/src/Wallabag/ImportBundle/Import/FirefoxImport.php @@ -57,7 +57,7 @@ class FirefoxImport extends BrowserImport 'created_at' => substr($entry['dateAdded'], 0, 10), ]; - if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { + if (\array_key_exists('tags', $entry) && '' !== $entry['tags']) { $data['tags'] = $entry['tags']; } diff --git a/src/Wallabag/ImportBundle/Import/WallabagImport.php b/src/Wallabag/ImportBundle/Import/WallabagImport.php index c3a142b9..75a28fbf 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagImport.php +++ b/src/Wallabag/ImportBundle/Import/WallabagImport.php @@ -122,7 +122,7 @@ abstract class WallabagImport extends AbstractImport // update entry with content (in case fetching failed, the given entry will be return) $this->fetchContent($entry, $data['url'], $data); - if (array_key_exists('tags', $data)) { + if (\array_key_exists('tags', $data)) { $this->tagsAssigner->assignTagsToEntry( $entry, $data['tags'], diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index b9bb525a..e0562611 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php @@ -61,7 +61,7 @@ class WallabagV1Import extends WallabagImport $data['html'] = $this->fetchingErrorMessage; } - if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { + if (\array_key_exists('tags', $entry) && '' !== $entry['tags']) { $data['tags'] = $entry['tags']; } -- cgit v1.2.3 From 8c0ba953070dca22e9a06999cfe355ea01847c64 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 27 Feb 2019 14:59:50 +0100 Subject: Adding more tests --- src/Wallabag/ImportBundle/Import/AbstractImport.php | 2 +- src/Wallabag/ImportBundle/Import/BrowserImport.php | 6 +++--- src/Wallabag/ImportBundle/Import/InstapaperImport.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Wallabag/ImportBundle/Import') diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php index 5ae4aa8d..d39d71b6 100644 --- a/src/Wallabag/ImportBundle/Import/AbstractImport.php +++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php @@ -169,7 +169,7 @@ abstract class AbstractImport implements ImportInterface $entry = $this->parseEntry($importedEntry); if (null === $entry) { - break; + continue; } // store each entry to be flushed so we can trigger the entry.saved event for each of them diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index 99717beb..3987e80f 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php @@ -158,13 +158,13 @@ abstract class BrowserImport extends AbstractImport foreach ($entries as $importedEntry) { if ((array) $importedEntry !== $importedEntry) { - break; + continue; } $entry = $this->parseEntry($importedEntry); if (null === $entry) { - break; + continue; } // @see AbstractImport @@ -206,7 +206,7 @@ abstract class BrowserImport extends AbstractImport { foreach ($entries as $importedEntry) { if ((array) $importedEntry !== $importedEntry) { - break; + continue; } // set userId for the producer (it won't know which user is connected) diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 6b6b35af..439c978c 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -65,7 +65,7 @@ class InstapaperImport extends AbstractImport $handle = fopen($this->filepath, 'r'); while (false !== ($data = fgetcsv($handle, 10240))) { if ('URL' === $data[0]) { - break; + continue; } // last element in the csv is the folder where the content belong -- cgit v1.2.3 From 9ca670c801cddef0ba47adc3be02945164f6bc85 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 24 May 2019 14:37:54 +0200 Subject: Fix Instapaper import date --- src/Wallabag/ImportBundle/Import/InstapaperImport.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Wallabag/ImportBundle/Import') diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 439c978c..f7bee9ef 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -93,6 +93,10 @@ class InstapaperImport extends AbstractImport return false; } + // most recent articles are first, which means we should create them at the end so they will show up first + // as Instapaper doesn't export the creation date of the article + $entries = array_reverse($entries); + if ($this->producer) { $this->parseEntriesForProducer($entries); -- cgit v1.2.3 From bf9ace0643f654e7ccd9c020b8b501ad56cd19de Mon Sep 17 00:00:00 2001 From: adev Date: Tue, 24 Oct 2017 22:55:40 +0200 Subject: Use httplug --- src/Wallabag/ImportBundle/Import/PocketImport.php | 90 ++++++++++++----------- 1 file changed, 47 insertions(+), 43 deletions(-) (limited to 'src/Wallabag/ImportBundle/Import') diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index a39d8156..9467fae2 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php @@ -2,13 +2,22 @@ namespace Wallabag\ImportBundle\Import; -use GuzzleHttp\Client; -use GuzzleHttp\Exception\RequestException; +use Http\Client\Common\HttpMethodsClient; +use Http\Client\Common\Plugin\ErrorPlugin; +use Http\Client\Common\PluginClient; +use Http\Client\HttpClient; +use Http\Discovery\MessageFactoryDiscovery; +use Http\Message\MessageFactory; +use Http\Client\Exception\RequestException; use Wallabag\CoreBundle\Entity\Entry; +use Psr\Http\Message\ResponseInterface; class PocketImport extends AbstractImport { const NB_ELEMENTS = 5000; + /** + * @var HttpMethodsClient + */ private $client; private $accessToken; @@ -55,24 +64,18 @@ class PocketImport extends AbstractImport */ public function getRequestToken($redirectUri) { - $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/request', - [ - 'body' => json_encode([ - 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(), - 'redirect_uri' => $redirectUri, - ]), - ] - ); - try { - $response = $this->client->send($request); + $response = $this->client->post('https://getpocket.com/v3/oauth/request', [], json_encode([ + 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(), + 'redirect_uri' => $redirectUri, + ])); } catch (RequestException $e) { $this->logger->error(sprintf('PocketImport: Failed to request token: %s', $e->getMessage()), ['exception' => $e]); return false; } - return $response->json()['code']; + return $this->jsonDecode($response)['code']; } /** @@ -85,24 +88,19 @@ class PocketImport extends AbstractImport */ public function authorize($code) { - $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/authorize', - [ - 'body' => json_encode([ - 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(), - 'code' => $code, - ]), - ] - ); try { - $response = $this->client->send($request); + $response = $this->client->post('https://getpocket.com/v3/oauth/authorize', [], json_encode([ + 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(), + 'code' => $code, + ])); } catch (RequestException $e) { $this->logger->error(sprintf('PocketImport: Failed to authorize client: %s', $e->getMessage()), ['exception' => $e]); return false; } - $this->accessToken = $response->json()['access_token']; + $this->accessToken = $this->jsonDecode($response)['access_token']; return true; } @@ -114,29 +112,23 @@ class PocketImport extends AbstractImport { static $run = 0; - $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/get', - [ - 'body' => json_encode([ - 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(), - 'access_token' => $this->accessToken, - 'detailType' => 'complete', - 'state' => 'all', - 'sort' => 'newest', - 'count' => self::NB_ELEMENTS, - 'offset' => $offset, - ]), - ] - ); - try { - $response = $this->client->send($request); + $response = $this->client->post('https://getpocket.com/v3/get', [], json_encode([ + 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(), + 'access_token' => $this->accessToken, + 'detailType' => 'complete', + 'state' => 'all', + 'sort' => 'newest', + 'count' => self::NB_ELEMENTS, + 'offset' => $offset, + ])); } catch (RequestException $e) { $this->logger->error(sprintf('PocketImport: Failed to import: %s', $e->getMessage()), ['exception' => $e]); return false; } - $entries = $response->json(); + $entries = $this->jsonDecode($response); if ($this->producer) { $this->parseEntriesForProducer($entries['list']); @@ -159,13 +151,14 @@ class PocketImport extends AbstractImport } /** - * Set the Guzzle client. + * Set the Http client. * - * @param Client $client + * @param HttpClient $client + * @param MessageFactory|null $messageFactory */ - public function setClient(Client $client) + public function setClient(HttpClient $client, MessageFactory $messageFactory = null) { - $this->client = $client; + $this->client = new HttpMethodsClient(new PluginClient($client, [new ErrorPlugin()]), $messageFactory ?: MessageFactoryDiscovery::find()); } /** @@ -252,4 +245,15 @@ class PocketImport extends AbstractImport return $importedEntry; } + + protected function jsonDecode(ResponseInterface $response) + { + $data = \json_decode((string) $response->getBody(), true); + + if (JSON_ERROR_NONE !== json_last_error()) { + throw new \InvalidArgumentException('Unable to parse JSON data: ' . json_last_error_msg()); + } + + return $data; + } } -- cgit v1.2.3 From 5f08426201c336f96d593954fb45b284d7e60f4a Mon Sep 17 00:00:00 2001 From: adev Date: Sat, 11 Nov 2017 20:04:15 +0100 Subject: Fix because of some breaking changes of Graby 2.0 --- src/Wallabag/ImportBundle/Import/WallabagV2Import.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/ImportBundle/Import') diff --git a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php index 3e085ecf..2ba26003 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php @@ -35,7 +35,9 @@ class WallabagV2Import extends WallabagImport { return [ 'html' => $entry['content'], - 'content_type' => $entry['mimetype'], + 'headers' => [ + 'content-type' => $entry['mimetype'], + ], 'is_archived' => (bool) ($entry['is_archived'] || $this->markAsRead), 'is_starred' => (bool) $entry['is_starred'], ] + $entry; -- cgit v1.2.3 From 448d99f84e93697ce49ec31224addb1da1a37a9f Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 28 Jan 2019 06:10:26 +0100 Subject: CS --- src/Wallabag/ImportBundle/Import/PocketImport.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/Wallabag/ImportBundle/Import') diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index 9467fae2..b35a561b 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php @@ -5,12 +5,12 @@ namespace Wallabag\ImportBundle\Import; use Http\Client\Common\HttpMethodsClient; use Http\Client\Common\Plugin\ErrorPlugin; use Http\Client\Common\PluginClient; +use Http\Client\Exception\RequestException; use Http\Client\HttpClient; use Http\Discovery\MessageFactoryDiscovery; use Http\Message\MessageFactory; -use Http\Client\Exception\RequestException; -use Wallabag\CoreBundle\Entity\Entry; use Psr\Http\Message\ResponseInterface; +use Wallabag\CoreBundle\Entity\Entry; class PocketImport extends AbstractImport { @@ -88,7 +88,6 @@ class PocketImport extends AbstractImport */ public function authorize($code) { - try { $response = $this->client->post('https://getpocket.com/v3/oauth/authorize', [], json_encode([ 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(), @@ -153,7 +152,7 @@ class PocketImport extends AbstractImport /** * Set the Http client. * - * @param HttpClient $client + * @param HttpClient $client * @param MessageFactory|null $messageFactory */ public function setClient(HttpClient $client, MessageFactory $messageFactory = null) -- cgit v1.2.3 From a91a3150fbc4446e379cc23618db8f74e4044515 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 7 Feb 2019 17:30:38 +0100 Subject: CS --- src/Wallabag/ImportBundle/Import/PocketImport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/ImportBundle/Import') diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index b35a561b..746120af 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php @@ -247,7 +247,7 @@ class PocketImport extends AbstractImport protected function jsonDecode(ResponseInterface $response) { - $data = \json_decode((string) $response->getBody(), true); + $data = json_decode((string) $response->getBody(), true); if (JSON_ERROR_NONE !== json_last_error()) { throw new \InvalidArgumentException('Unable to parse JSON data: ' . json_last_error_msg()); -- cgit v1.2.3