aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2015-03-13 23:33:49 +0100
committerThomas Citharel <tcit@tcit.fr>2015-03-13 23:33:49 +0100
commitf5618feb73343f0a120a809116c443630d70a87c (patch)
treef544c7db283dd77a1c639de7b5299df0490f61ff
parent3d2b9e2e237780e8f2a207e1b964b32679407265 (diff)
downloadwallabag-f5618feb73343f0a120a809116c443630d70a87c.tar.gz
wallabag-f5618feb73343f0a120a809116c443630d70a87c.tar.zst
wallabag-f5618feb73343f0a120a809116c443630d70a87c.zip
fix #1154
-rwxr-xr-xinc/poche/Tools.class.php7
-rwxr-xr-xinstall/index.php4
-rw-r--r--install/install_functions.php10
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
392 ); 392 );
393 393
394 foreach ($files as $fileInfo) { 394 foreach ($files as $fileInfo) {
395 $todo = ($fileInfo->isDir() ? 'rmdir' : 'unlink'); 395 $filename = $fileInfo->getFilename();
396 $todo($fileInfo->getRealPath()); 396 if (!$filename[0] == '.') {
397 $todo = ($fileInfo->isDir() ? 'rmdir' : 'unlink');
398 $todo($fileInfo->getRealPath());
399 }
397 } 400 }
398 401
399 Tools::logm('empty cache'); 402 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');
18 18
19if (isset($_GET['clean'])) { 19if (isset($_GET['clean'])) {
20 if (is_dir('install')){ 20 if (is_dir('install')){
21 delTree('install'); 21 delTree('install', true);
22 header('Location: index.php'); 22 header('Location: index.php');
23 } 23 }
24 if (is_dir('cache')) { 24 if (is_dir('cache')) {
25 delTree('cache', false); 25 delTree('cache', false, false);
26 header('Location: index.php'); 26 header('Location: index.php');
27 } 27 }
28} 28}
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() {
78 * Here in case of .gitignore files 78 * Here in case of .gitignore files
79 */ 79 */
80 80
81function delTree($dir, $withdirectory="true") { 81function delTree($dir, $withdirectory=true, $hiddenfiles = true) {
82 $files = array_diff(scandir($dir), array('.','..')); 82 if ($hiddenfiles) {
83 foreach ($files as $file) { 83 $files = array_diff(scandir($dir), array('.','..'));
84 (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file"); 84 foreach ($files as $file) {
85 (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file");
86 }
85 } 87 }
86 if ($withdirectory) { 88 if ($withdirectory) {
87 return rmdir($dir); 89 return rmdir($dir);