File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,28 +30,12 @@ public function removeQueueDirectories(): void
3030 }
3131
3232 /**
33- * Remove the given file. If the file do not exists, the function return true.
33+ * Remove the given file. If the file do not exists afterwards, the function returns true.
34+ * Silently ignores errors, if the file was already gone, this is fine as well.
3435 */
35- public function file (string $ absoulteFileName ): bool
36+ public function file (string $ absoluteFilename ): bool
3637 {
37- if (!is_file ($ absoulteFileName )) {
38- return true ;
39- }
40-
41-
42- if (!@unlink ($ absoulteFileName )) {
43- if (!@is_writable ($ absoulteFileName )) {
44- throw new \RuntimeException ('Could not remove file: ' . $ absoulteFileName , 123678123 );
45- }
46- // Return true if the file no longer exists (don't care _what_ removed
47- // the file, as long as it's gone).
48- // But return false if the file still exists but couldn't be removed
49- // by unlink() (for reasons other than write permissions).
50- // Alternatively, throw an exception if file_exists($file) informing that
51- // the file couldn't be removed and this is an error causing stale caches.
52- return !file_exists ($ absoulteFileName );
53- }
54- return true ;
38+ return @unlink ($ absoluteFilename ) || !file_exists ($ absoluteFilename );
5539 }
5640
5741 /**
You can’t perform that action at this time.
0 commit comments