Skip to content

Commit

Permalink
// Fixed deleteDirectory function (is_dir is cached and must not be u…
Browse files Browse the repository at this point in the history
…sed, because use the result of scandir)
  • Loading branch information
Damien Metzger committed Dec 28, 2012
1 parent a354697 commit 1dde9b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions classes/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
3 changes: 1 addition & 2 deletions controllers/admin/AdminTranslationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1dde9b6

Please sign in to comment.