diff options
author | Morris Jobke <morris.jobke@gmail.com> | 2013-08-26 20:04:49 +0400 |
---|---|---|
committer | Morris Jobke <morris.jobke@gmail.com> | 2013-08-26 20:04:49 +0400 |
commit | 7d141656ee837199f58d6a29033ded7d5c2a4632 (patch) | |
tree | c465375f531b8924acd70abc49b60bbcbf1e4d14 | |
parent | 29c28a45cacebfcca7df7577334e76da001f2eb1 (diff) | |
parent | 881e362f932bfd2d3b5daddd83545d09bda16e40 (diff) |
Merge branch 'xsendfile_complete_zip_fix' of github.com:riso/owncloud-core into riso-xsendfile_complete_zip_fix from pull request #3307
Conflicts:
lib/helper.php
-rw-r--r-- | lib/helper.php | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/helper.php b/lib/helper.php index 1024a570e36..c7687d431e1 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -591,9 +591,26 @@ class OC_Helper { * remove all files in PHP /oc-noclean temp dir */ public static function cleanTmpNoClean() { - $tmpDirNoCleanFile = get_temp_dir() . '/oc-noclean/'; - if (file_exists($tmpDirNoCleanFile)) { - self::rmdirr($tmpDirNoCleanFile); + $tmpDirNoCleanName=get_temp_dir() . '/oc-noclean/'; + if(file_exists($tmpDirNoCleanName) && is_dir($tmpDirNoCleanName)) { + $files=scandir($tmpDirNoCleanName); + foreach($files as $file) { + $fileName = $tmpDirNoCleanName . $file; + if (!\OC\Files\Filesystem::isIgnoredDir($file) && filemtime($fileName) + 600 < time()) { + unlink($fileName); + } + } + // if oc-noclean is empty delete it + $isTmpDirNoCleanEmpty = true; + $tmpDirNoClean = opendir($tmpDirNoCleanName); + while (false !== ($file = readdir($tmpDirNoClean))) { + if (!\OC\Files\Filesystem::isIgnoredDir($file)) { + $isTmpDirNoCleanEmpty = false; + } + } + if ($isTmpDirNoCleanEmpty) { + rmdir($tmpDirNoCleanName); + } } } |