From f5618feb73343f0a120a809116c443630d70a87c Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 13 Mar 2015 23:33:49 +0100 Subject: fix #1154 --- inc/poche/Tools.class.php | 7 +++++-- install/index.php | 4 ++-- install/install_functions.php | 10 ++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index d0b31d4f..c8fb2e52 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -392,8 +392,11 @@ final class Tools ); foreach ($files as $fileInfo) { - $todo = ($fileInfo->isDir() ? 'rmdir' : 'unlink'); - $todo($fileInfo->getRealPath()); + $filename = $fileInfo->getFilename(); + if (!$filename[0] == '.') { + $todo = ($fileInfo->isDir() ? 'rmdir' : 'unlink'); + $todo($fileInfo->getRealPath()); + } } Tools::logm('empty cache'); diff --git a/install/index.php b/install/index.php index 16e0078d..69957283 100755 --- a/install/index.php +++ b/install/index.php @@ -18,11 +18,11 @@ require_once('install_functions.php'); if (isset($_GET['clean'])) { if (is_dir('install')){ - delTree('install'); + delTree('install', true); header('Location: index.php'); } if (is_dir('cache')) { - delTree('cache', false); + delTree('cache', false, false); header('Location: index.php'); } } diff --git a/install/install_functions.php b/install/install_functions.php index 3cfe13fb..a40db373 100644 --- a/install/install_functions.php +++ b/install/install_functions.php @@ -78,10 +78,12 @@ function pdoDrivers() { * Here in case of .gitignore files */ -function delTree($dir, $withdirectory="true") { - $files = array_diff(scandir($dir), array('.','..')); - foreach ($files as $file) { - (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file"); +function delTree($dir, $withdirectory=true, $hiddenfiles = true) { + if ($hiddenfiles) { + $files = array_diff(scandir($dir), array('.','..')); + foreach ($files as $file) { + (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file"); + } } if ($withdirectory) { return rmdir($dir); -- cgit v1.2.3