-
-
Notifications
You must be signed in to change notification settings - Fork 11
Clear stat cache in FileCache::set() #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4a68963
d4bc516
5db1776
a7be281
683bd75
4df598e
e1b10dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,7 +89,7 @@ | |
| */ | ||
| public function __construct( | ||
| private string $cachePath, | ||
| private int $directoryMode = 0775, | ||
|
Check warning on line 92 in src/FileCache.php
|
||
| ) { | ||
| if (!$this->createDirectoryIfNotExists($cachePath)) { | ||
| throw new CacheException("Failed to create cache directory \"$cachePath\"."); | ||
|
|
@@ -132,10 +132,10 @@ | |
| throw new CacheException("Failed to create cache directory \"$cacheDirectory\"."); | ||
| } | ||
|
|
||
| // If ownership differs the touch call will fail, so we try to | ||
| // If ownership differs, the touch call will fail, so we try to | ||
| // rebuild the file from scratch by deleting it first | ||
| // https://github.com/yiisoft/yii2/pull/16120 | ||
| if (function_exists('posix_geteuid') && is_file($file) && fileowner($file) !== posix_geteuid()) { | ||
|
Check warning on line 138 in src/FileCache.php
|
||
| @unlink($file); | ||
| } | ||
|
|
||
|
|
@@ -150,7 +150,12 @@ | |
| } | ||
| } | ||
|
|
||
| $result = @touch($file, $expiration); | ||
| $result = false; | ||
|
|
||
| if (@touch($file, $expiration)) { | ||
| clearstatcache(); | ||
samdark marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $result = true; | ||
| } | ||
|
|
||
| return $this->isLastErrorSafe($result); | ||
| } | ||
|
|
@@ -197,7 +202,7 @@ | |
| $this->set((string) $key, $value, $ttl); | ||
| } | ||
|
|
||
| return true; | ||
|
Check warning on line 205 in src/FileCache.php
|
||
| } | ||
|
|
||
| public function deleteMultiple(iterable $keys): bool | ||
|
|
@@ -209,7 +214,7 @@ | |
| $this->delete($key); | ||
| } | ||
|
|
||
| return true; | ||
|
Check warning on line 217 in src/FileCache.php
|
||
| } | ||
|
|
||
| public function has(string $key): bool | ||
|
|
@@ -332,7 +337,7 @@ | |
| return true; | ||
| } | ||
|
|
||
| $result = !is_file($path) && mkdir(directory: $path, recursive: true) && is_dir($path); | ||
|
Check warning on line 340 in src/FileCache.php
|
||
|
|
||
| if ($result) { | ||
| chmod($path, $this->directoryMode); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.