diff --git a/system/autoload/File.php b/system/autoload/File.php index 60d256bb..9f94b7c2 100644 --- a/system/autoload/File.php +++ b/system/autoload/File.php @@ -6,7 +6,6 @@ class File public static function copyFolder($from, $to, $exclude = []) { $files = scandir($from); - print_r($files); foreach ($files as $file) { if (is_file($from . $file) && !in_array($file, $exclude)) { if (file_exists($to . $file)) unlink($to . $file); diff --git a/update.php b/update.php index 601387d2..9cf804da 100644 --- a/update.php +++ b/update.php @@ -33,9 +33,9 @@ if (!extension_loaded('zip')) { $file = pathFixer('system/cache/phpnuxbill.zip'); $folder = pathFixer('system/cache/phpnuxbill-master'); -if(empty($step)){ +if (empty($step)) { $step++; -}else if ($step == 1) { +} else if ($step == 1) { if (file_exists($file)) unlink($file); // Download update @@ -50,39 +50,39 @@ if(empty($step)){ curl_exec($ch); curl_close($ch); fclose($fp); - if (file_exists($file)){ + if (file_exists($file)) { $step++; - }else{ + } else { $msg = "Failed to download Update file"; $msgType = "danger"; $continue = false; } -}else if ($step == 2) { +} else if ($step == 2) { $zip = new ZipArchive(); $zip->open($file); $zip->extractTo(pathFixer('system/cache/')); $zip->close(); - if (file_exists($folder)){ + if (file_exists($folder)) { $step++; - }else{ + } else { $msg = "Failed to extract update file"; $msgType = "danger"; $continue = false; } // remove downloaded zip if (file_exists($file)) unlink($file); -}else if ($step == 3) { +} else if ($step == 3) { copyFolder($folder, pathFixer('./')); deleteFolder('install/'); deleteFolder($folder); - if (!file_exists($folder.pathFixer('/system/'))){ + if (!file_exists($folder . pathFixer('/system/'))) { $step++; - }else{ + } else { $msg = "Failed to install update file."; $msgType = "danger"; $continue = false; } -}else { +} else { $version = json_decode(file_get_contents('version.json'), true)['version']; $continue = false; } @@ -107,7 +107,6 @@ function r2($to, $ntype = 'e', $msg = '') function copyFolder($from, $to, $exclude = []) { $files = scandir($from); - print_r($files); foreach ($files as $file) { if (is_file($from . $file) && !in_array($file, $exclude)) { if (file_exists($to . $file)) unlink($to . $file); @@ -127,7 +126,7 @@ function deleteFolder($path) if (is_file($path . $file)) { unlink($path . $file); } else if (is_dir($path . $file) && !in_array($file, ['.', '..'])) { - File::deleteFolder($path . $file . DIRECTORY_SEPARATOR); + deleteFolder($path . $file . DIRECTORY_SEPARATOR); rmdir($path . $file); } } @@ -152,8 +151,8 @@ function deleteFolder($path) - - + +