Permalink
Browse files

// Fixed deleteDirectory function (is_dir is cached and must not be u…

…sed, because use the result of scandir)
  • Loading branch information...
1 parent a354697 commit 1dde9b6f2aca1097be0d38ec46ba9089bb949e5f Damien Metzger committed Dec 28, 2012
Showing with 2 additions and 4 deletions.
  1. +1 −2 classes/Tools.php
  2. +1 −2 controllers/admin/AdminTranslationsController.php
View
@@ -669,8 +669,7 @@ public static function safePostVars()
public static function deleteDirectory($dirname, $delete_self = true)
{
$dirname = rtrim($dirname, '/').'/';
- $files = scandir($dirname);
- if (is_dir($dirname))
+ if ($files = scandir($dirname))
{
foreach ($files as $file)
if ($file != '.' && $file != '..' && $file != '.svn')
@@ -655,9 +655,8 @@ public function submitImportLang()
elseif (!preg_match('@^[0-9a-z-_/\\\\]+\.(html|tpl|txt)$@i', $file2check['filename']))
$this->errors[] = sprintf(Tools::displayError('Unidentified file found: %s'), $file2check['filename']);
}
-
+ Tools::deleteDirectory($sandbox, true);
}
- Tools::deleteDirectory($sandbox, true);
if (count($this->errors))
return false;

0 comments on commit 1dde9b6

Please sign in to comment.