diff options
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/FileCookieJar.php | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/FileCookieJar.php b/src/Wallabag/CoreBundle/Helper/FileCookieJar.php index 9a63e949..4b4dca10 100644 --- a/src/Wallabag/CoreBundle/Helper/FileCookieJar.php +++ b/src/Wallabag/CoreBundle/Helper/FileCookieJar.php | |||
@@ -9,7 +9,6 @@ use Psr\Log\LoggerInterface; | |||
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Overidden Cookie behavior to: | 11 | * Overidden Cookie behavior to: |
12 | * - fix multiple concurrent writes (see https://github.com/guzzle/guzzle/pull/1884) | ||
13 | * - ignore error when the cookie file is malformatted (resulting in clearing it). | 12 | * - ignore error when the cookie file is malformatted (resulting in clearing it). |
14 | */ | 13 | */ |
15 | class FileCookieJar extends BaseFileCookieJar | 14 | class FileCookieJar extends BaseFileCookieJar |
@@ -28,29 +27,6 @@ class FileCookieJar extends BaseFileCookieJar | |||
28 | } | 27 | } |
29 | 28 | ||
30 | /** | 29 | /** |
31 | * Saves the cookies to a file. | ||
32 | * | ||
33 | * @param string $filename File to save | ||
34 | * | ||
35 | * @throws \RuntimeException if the file cannot be found or created | ||
36 | */ | ||
37 | public function save($filename) | ||
38 | { | ||
39 | $json = []; | ||
40 | foreach ($this as $cookie) { | ||
41 | if ($cookie->getExpires() && !$cookie->getDiscard()) { | ||
42 | $json[] = $cookie->toArray(); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | if (false === file_put_contents($filename, json_encode($json), LOCK_EX)) { | ||
47 | // @codeCoverageIgnoreStart | ||
48 | throw new \RuntimeException("Unable to save file {$filename}"); | ||
49 | // @codeCoverageIgnoreEnd | ||
50 | } | ||
51 | } | ||
52 | |||
53 | /** | ||
54 | * Load cookies from a JSON formatted file. | 30 | * Load cookies from a JSON formatted file. |
55 | * | 31 | * |
56 | * Old cookies are kept unless overwritten by newly loaded ones. | 32 | * Old cookies are kept unless overwritten by newly loaded ones. |