Skip to content

Commit cbbc2a5

Browse files
committed
Filesystem 2.0.7
1 parent d00d19b commit cbbc2a5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v2.0.7, 2020-07-24
2+
* improve delete() and deleteDir() methods.
3+
14
# v2.0.6, 2019-09-06
25
* typo fixes.
36

Filesystem.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,16 @@ public static function setVisibility(string $path, string $visibility) : bool
292292
*/
293293
public static function delete(string $path) : bool
294294
{
295-
return @unlink($path);
295+
if (self::has($path)) {
296+
$result = unlink($path);
297+
298+
// Wiping out changes in local file cache
299+
clearstatcache(false, $path);
300+
301+
return $result;
302+
}
303+
304+
return false;
296305
}
297306

298307
/**
@@ -317,7 +326,7 @@ public static function deleteDir(string $dirname) : bool
317326
if (filetype($dirname . '/' . $o) === 'dir') {
318327
self::deleteDir($dirname . '/' . $o);
319328
} else {
320-
unlink($dirname . '/' . $o);
329+
self::delete($dirname . '/' . $o);
321330
}
322331
}
323332
}

0 commit comments

Comments
 (0)