Skip to content

Commit

Permalink
Added FileSystem::clearCache() method
Browse files Browse the repository at this point in the history
  • Loading branch information
freost committed Oct 22, 2024
1 parent 67a9c1b commit 3d0858d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ The major version bump is due to upping the required PHP version from `8.1` to `
* Added `FileSystem::isExecutable()` method.
* Added `FileInfo::hasPermissions()` method that accepts an integer or a `Permissions` instance.
* Added `FileInfo::getPermissions()` method that returns a `Permissions` instance.
* Added `FileSystem::clearCache()` method.

#### Changes

Expand Down
9 changes: 9 additions & 0 deletions src/mako/file/FileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use SplFileObject;

use function chmod;
use function clearstatcache;
use function copy;
use function disk_free_space;
use function disk_total_space;
Expand Down Expand Up @@ -42,6 +43,14 @@
*/
class FileSystem
{
/**
* Clears the file status cache.
*/
public function clearCache(bool $clearRealPathCache = false, string $filename = ''): void
{
clearstatcache($clearRealPathCache, $filename);
}

/**
* Returns TRUE if a resource exists and FALSE if not.
*/
Expand Down

0 comments on commit 3d0858d

Please sign in to comment.