diff options
author | cash <cash.costello@gmail.com> | 2012-01-25 19:30:38 -0500 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2012-01-25 19:30:38 -0500 |
commit | 2bbb2d4630ff0f1a50748621b3943e5c5a8ce5d9 (patch) | |
tree | f99ee958558506d8b2fe0fd5481ce89b0ce5765a | |
parent | dd5690916b8acb952669914c0e7dfc3ebf0842c2 (diff) | |
download | elgg-2bbb2d4630ff0f1a50748621b3943e5c5a8ce5d9.tar.gz elgg-2bbb2d4630ff0f1a50748621b3943e5c5a8ce5d9.tar.bz2 |
implemented the clear method of the file cache
-rw-r--r-- | engine/classes/ElggFileCache.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/engine/classes/ElggFileCache.php b/engine/classes/ElggFileCache.php index 8304372dc..34178d452 100644 --- a/engine/classes/ElggFileCache.php +++ b/engine/classes/ElggFileCache.php @@ -161,12 +161,25 @@ class ElggFileCache extends ElggCache { } /** - * This was probably meant to delete everything? + * Delete all files in the directory of this file cache * * @return void */ public function clear() { - // @todo writeme + $dir = $this->getVariable("cache_path"); + + $exclude = array(".", ".."); + + $files = scandir($dir); + if (!$files) { + return; + } + + foreach ($files as $f) { + if (!in_array($f, $exclude)) { + unlink($dir . $f); + } + } } /** @@ -184,7 +197,7 @@ class ElggFileCache extends ElggCache { return; } - $exclude = array(".",".."); + $exclude = array(".", ".."); $files = scandir($dir); if (!$files) { |