mirror of
https://github.com/wallabag/wallabag.git
synced 2025-04-25 19:34:07 +00:00
Merge pull request #4303 from wallabag/fix/cleanup-cookie
Cleanup cookie jar
This commit is contained in:
commit
6277578d4f
1 changed files with 0 additions and 24 deletions
|
@ -9,7 +9,6 @@ use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overidden Cookie behavior to:
|
* Overidden Cookie behavior to:
|
||||||
* - fix multiple concurrent writes (see https://github.com/guzzle/guzzle/pull/1884)
|
|
||||||
* - ignore error when the cookie file is malformatted (resulting in clearing it).
|
* - ignore error when the cookie file is malformatted (resulting in clearing it).
|
||||||
*/
|
*/
|
||||||
class FileCookieJar extends BaseFileCookieJar
|
class FileCookieJar extends BaseFileCookieJar
|
||||||
|
@ -27,29 +26,6 @@ class FileCookieJar extends BaseFileCookieJar
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves the cookies to a file.
|
|
||||||
*
|
|
||||||
* @param string $filename File to save
|
|
||||||
*
|
|
||||||
* @throws \RuntimeException if the file cannot be found or created
|
|
||||||
*/
|
|
||||||
public function save($filename)
|
|
||||||
{
|
|
||||||
$json = [];
|
|
||||||
foreach ($this as $cookie) {
|
|
||||||
if ($cookie->getExpires() && !$cookie->getDiscard()) {
|
|
||||||
$json[] = $cookie->toArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (false === file_put_contents($filename, json_encode($json), LOCK_EX)) {
|
|
||||||
// @codeCoverageIgnoreStart
|
|
||||||
throw new \RuntimeException("Unable to save file {$filename}");
|
|
||||||
// @codeCoverageIgnoreEnd
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load cookies from a JSON formatted file.
|
* Load cookies from a JSON formatted file.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue