@@ -69,7 +69,6 @@ discard block |
||
69 | 69 | * @param LoggerInterface|LogInterface $log |
70 | 70 | * @param string $cacheDirectory |
71 | 71 | * @param boolean $relativeToSystemTempDirectory |
72 | - * @param int $hashDepth |
|
73 | 72 | */ |
74 | 73 | function __construct($defaultTimeToLive, $log, $cacheDirectory, $relativeToSystemTempDirectory) |
75 | 74 | { |
@@ -263,6 +262,9 @@ discard block |
||
263 | 262 | return $dir.$subFolder; |
264 | 263 | } |
265 | 264 | |
265 | + /** |
|
266 | + * @param string $key |
|
267 | + */ |
|
266 | 268 | protected function getFileName($key) { |
267 | 269 | $subFolder = $this->getDirectory($key); |
268 | 270 | // Remove any "/" and ":" from the name, and replace those with "_" ... |
@@ -281,6 +283,9 @@ discard block |
||
281 | 283 | return $subFolder.md5($key).'.cache'; |
282 | 284 | } |
283 | 285 | |
286 | + /** |
|
287 | + * @param string $dir |
|
288 | + */ |
|
284 | 289 | private static function rrmdir($dir) { |
285 | 290 | if (is_dir($dir)) { |
286 | 291 | $objects = scandir($dir); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | if ($key){ |
258 | 258 | $subFolder = substr(hash("sha256", $key), 0, $this->hashDepth) . "/"; |
259 | - }else{ |
|
259 | + } else{ |
|
260 | 260 | $subFolder = ""; |
261 | 261 | } |
262 | 262 | |
@@ -286,9 +286,11 @@ discard block |
||
286 | 286 | $objects = scandir($dir); |
287 | 287 | foreach ($objects as $object) { |
288 | 288 | if ($object != "." && $object != "..") { |
289 | - if (filetype($dir."/".$object) == "dir") |
|
290 | - self::rrmdir($dir."/".$object); |
|
291 | - else unlink ($dir."/".$object); |
|
289 | + if (filetype($dir."/".$object) == "dir") { |
|
290 | + self::rrmdir($dir."/".$object); |
|
291 | + } else { |
|
292 | + unlink ($dir."/".$object); |
|
293 | + } |
|
292 | 294 | } |
293 | 295 | } |
294 | 296 | reset($objects); |
@@ -110,7 +110,7 @@ |
||
110 | 110 | if(strpos($serializeData, 'r:') !== false || (is_object($value) && !method_exists($value, '__set_state'))){ |
111 | 111 | $code = sprintf('<?php return unserialize(%s);', var_export($serializeData, true)); |
112 | 112 | file_put_contents($filename, $code); |
113 | - }else{ |
|
113 | + } else{ |
|
114 | 114 | $data = var_export($data, true); |
115 | 115 | $code = sprintf('<?php return %s;', $data); |
116 | 116 | file_put_contents($filename, $code); |