# HG changeset patch # User Matti Hamalainen # Date 1521028369 -7200 # Node ID 74889db8e6a2cf7fb02a94080ed4e9326b6c9428 # Parent c0439644da6ad900d7e1413801db909428597179 Cleanup. diff -r c0439644da6a -r 74889db8e6a2 mgtool.php --- a/mgtool.php Wed Mar 14 13:51:18 2018 +0200 +++ b/mgtool.php Wed Mar 14 13:52:49 2018 +0200 @@ -317,7 +317,7 @@ // // Delete given directory OR file, recursively // -function mgDelete($path, $recurse) +function mgDelete($path, $showFiles) { global $flagDoDelete, $countDoDelete; if (is_dir($path)) @@ -328,8 +328,9 @@ while (($dirFile = @readdir($dirHandle)) !== FALSE) { if ($dirFile != "." && $dirFile != "..") - mgDelete($path."/".$dirFile, $recurse); + mgDelete($path."/".$dirFile, $showFiles); } + closedir($dirHandle); echo " - ".$path." [DIR]\n"; @@ -340,7 +341,7 @@ else if (file_exists($path)) { - if (!$recurse) + if ($showFiles) echo " - ".$path."\n"; $countDoDelete++; @@ -496,10 +497,10 @@ if ($writeMode) { if ($galCleanFlags & GCLEAN_CACHES) - mgDelete($cacheFilename, FALSE); + mgDelete($cacheFilename, TRUE); if ($galCleanFlags & GCLEAN_THUMBNAILS) - mgDelete($path."/".$galTNPath, TRUE); + mgDelete($path."/".$galTNPath, FALSE); } } else