summaryrefslogtreecommitdiffstats
path: root/lib/cache/fileglobal.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cache/fileglobal.php')
-rw-r--r--lib/cache/fileglobal.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/cache/fileglobal.php b/lib/cache/fileglobal.php
index 2fbd8ca3edb..c0bd8e45f39 100644
--- a/lib/cache/fileglobal.php
+++ b/lib/cache/fileglobal.php
@@ -69,9 +69,11 @@ class OC_Cache_FileGlobal{
$prefix = $this->fixKey($prefix);
if($cache_dir and is_dir($cache_dir)) {
$dh=opendir($cache_dir);
- while (($file = readdir($dh)) !== false) {
- if($file!='.' and $file!='..' and ($prefix==='' || strpos($file, $prefix) === 0)) {
- unlink($cache_dir.$file);
+ if(is_resource($dh)) {
+ while (($file = readdir($dh)) !== false) {
+ if($file!='.' and $file!='..' and ($prefix==='' || strpos($file, $prefix) === 0)) {
+ unlink($cache_dir.$file);
+ }
}
}
}
@@ -88,11 +90,13 @@ class OC_Cache_FileGlobal{
$cache_dir = self::getCacheDir();
if($cache_dir and is_dir($cache_dir)) {
$dh=opendir($cache_dir);
- while (($file = readdir($dh)) !== false) {
- if($file!='.' and $file!='..') {
- $mtime = filemtime($cache_dir.$file);
- if ($mtime < $now) {
- unlink($cache_dir.$file);
+ if(is_resource($dh)) {
+ while (($file = readdir($dh)) !== false) {
+ if($file!='.' and $file!='..') {
+ $mtime = filemtime($cache_dir.$file);
+ if ($mtime < $now) {
+ unlink($cache_dir.$file);
+ }
}
}
}