Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/http-kernel/HttpCache/Store.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/vendor/symfony/http-kernel/HttpCache/Store.php Mon Apr 23 09:33:26 2018 +0100 +++ b/vendor/symfony/http-kernel/HttpCache/Store.php Mon Apr 23 09:46:53 2018 +0100 @@ -29,8 +29,6 @@ private $locks; /** - * Constructor. - * * @param string $root The path to the cache directory * * @throws \RuntimeException @@ -62,8 +60,6 @@ /** * Tries to lock the cache for a given Request, without blocking. * - * @param Request $request A Request instance - * * @return bool|string true if the lock is acquired, the path to the current lock otherwise */ public function lock(Request $request) @@ -91,8 +87,6 @@ /** * Releases the lock for the given Request. * - * @param Request $request A Request instance - * * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise */ public function unlock(Request $request) @@ -133,8 +127,6 @@ /** * Locates a cached Response for the Request provided. * - * @param Request $request A Request instance - * * @return Response|null A Response instance, or null if no cache entry was found */ public function lookup(Request $request) @@ -159,7 +151,7 @@ return; } - list($req, $headers) = $match; + $headers = $match[1]; if (file_exists($body = $this->getPath($headers['x-content-digest'][0]))) { return $this->restoreResponse($headers, $body); } @@ -175,9 +167,6 @@ * Existing entries are read and any that match the response are removed. This * method calls write with the new list of cache entries. * - * @param Request $request A Request instance - * @param Response $response A Response instance - * * @return string The key under which the response is stored * * @throws \RuntimeException @@ -210,7 +199,7 @@ $entry[1]['vary'] = array(''); } - if ($vary != $entry[1]['vary'][0] || !$this->requestsMatch($vary, $entry[0], $storedEnv)) { + if ($entry[1]['vary'][0] != $vary || !$this->requestsMatch($vary, $entry[0], $storedEnv)) { $entries[] = $entry; } } @@ -230,8 +219,6 @@ /** * Returns content digest for $response. * - * @param Response $response - * * @return string */ protected function generateContentDigest(Response $response) @@ -242,8 +229,6 @@ /** * Invalidates all cache entries that match the request. * - * @param Request $request A Request instance - * * @throws \RuntimeException */ public function invalidate(Request $request) @@ -402,16 +387,22 @@ $tmpFile = tempnam(dirname($path), basename($path)); if (false === $fp = @fopen($tmpFile, 'wb')) { + @unlink($tmpFile); + return false; } @fwrite($fp, $data); @fclose($fp); if ($data != file_get_contents($tmpFile)) { + @unlink($tmpFile); + return false; } if (false === @rename($tmpFile, $path)) { + @unlink($tmpFile); + return false; } } @@ -434,8 +425,6 @@ * headers, use a Vary header to indicate them, and each representation will * be stored independently under the same cache key. * - * @param Request $request A Request instance - * * @return string A key for the given Request */ protected function generateCacheKey(Request $request) @@ -446,8 +435,6 @@ /** * Returns a cache key for the given Request. * - * @param Request $request A Request instance - * * @return string A key for the given Request */ private function getCacheKey(Request $request) @@ -462,8 +449,6 @@ /** * Persists the Request HTTP headers. * - * @param Request $request A Request instance - * * @return array An array of HTTP headers */ private function persistRequest(Request $request) @@ -474,8 +459,6 @@ /** * Persists the Response HTTP headers. * - * @param Response $response A Response instance - * * @return array An array of HTTP headers */ private function persistResponse(Response $response)