]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
fix #1154
authorThomas Citharel <tcit@tcit.fr>
Fri, 13 Mar 2015 22:33:49 +0000 (23:33 +0100)
committerThomas Citharel <tcit@tcit.fr>
Fri, 13 Mar 2015 22:33:49 +0000 (23:33 +0100)
inc/poche/Tools.class.php
install/index.php
install/install_functions.php

index d0b31d4f15648dbe70e9f507c921b3f0cc493183..c8fb2e527ba2dfbba6b4d391cc69d864234ba76b 100755 (executable)
@@ -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');
index 16e0078d3beeaaa5982b1edf2c9e3477530d5db0..699572839a5c4a4a0ad6b98cb939a5e74eb0af6b 100755 (executable)
@@ -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');      
     }
 }
index 3cfe13fb49a341d89b669124115e162bac44e875..a40db3738d89811977b851e3fcf81a67c9f1fcad 100644 (file)
@@ -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);