diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2020-03-29 11:39:49 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2020-03-29 11:39:49 +0200 |
commit | b12e23ad8a80097da47061c9329d418eee4607d0 (patch) | |
tree | d8270720f31b8018cbced167fae6b0f57dbda1e4 | |
parent | c9b83a13c0dd91aa3529797e481d144aaef363ca (diff) | |
download | wallabag-b12e23ad8a80097da47061c9329d418eee4607d0.tar.gz wallabag-b12e23ad8a80097da47061c9329d418eee4607d0.tar.zst wallabag-b12e23ad8a80097da47061c9329d418eee4607d0.zip |
Cleanup cookie jar
As of latest Guzzle release, it's fixed so we can removed that code.
-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. |