diff options
author | cash <cash.costello@gmail.com> | 2012-02-04 13:05:31 -0500 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2012-02-04 13:05:31 -0500 |
commit | 601ec5ccf5eb6940ca468b31e1b400412697c8cb (patch) | |
tree | 639b9d1d3591d61c86808a60fe354bce811ce52e /engine/classes | |
parent | 76d089fe3662a7051258d6d1843a1167ea8017b1 (diff) | |
parent | 06ba6ccfb8bb5a8da8464d8f86454b468744c9cc (diff) | |
download | elgg-601ec5ccf5eb6940ca468b31e1b400412697c8cb.tar.gz elgg-601ec5ccf5eb6940ca468b31e1b400412697c8cb.tar.bz2 |
Merge pull request #156 from cash/cache_lang
Fixes #2877 Adds language string caching to system cache
Diffstat (limited to 'engine/classes')
-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) { |