Check directory handle before we use it
This commit is contained in:
parent
e2d4b3c123
commit
45e3cbefc9
1 changed files with 8 additions and 6 deletions
|
@ -132,12 +132,14 @@ class TempManager implements ITempManager {
|
|||
$cutOfTime = time() - 3600;
|
||||
$files = array();
|
||||
$dh = opendir($this->tmpBaseDir);
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if (substr($file, 0, 7) === 'oc_tmp_') {
|
||||
$path = $this->tmpBaseDir . '/' . $file;
|
||||
$mtime = filemtime($path);
|
||||
if ($mtime < $cutOfTime) {
|
||||
$files[] = $path;
|
||||
if ($dh) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if (substr($file, 0, 7) === 'oc_tmp_') {
|
||||
$path = $this->tmpBaseDir . '/' . $file;
|
||||
$mtime = filemtime($path);
|
||||
if ($mtime < $cutOfTime) {
|
||||
$files[] = $path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue