diff options
author | Kevin Decherf <kevin@kdecherf.com> | 2020-03-29 15:30:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-29 15:30:13 +0200 |
commit | 6277578d4f3a3acecaab6f677b2ac81db2d2981e (patch) | |
tree | d8270720f31b8018cbced167fae6b0f57dbda1e4 /src/Wallabag | |
parent | c9b83a13c0dd91aa3529797e481d144aaef363ca (diff) | |
parent | b12e23ad8a80097da47061c9329d418eee4607d0 (diff) | |
download | wallabag-6277578d4f3a3acecaab6f677b2ac81db2d2981e.tar.gz wallabag-6277578d4f3a3acecaab6f677b2ac81db2d2981e.tar.zst wallabag-6277578d4f3a3acecaab6f677b2ac81db2d2981e.zip |
Merge pull request #4303 from wallabag/fix/cleanup-cookie
Cleanup cookie jar
Diffstat (limited to 'src/Wallabag')
-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. |