Please wait....
Please wait....
Please wait....
open($file); $zip->extractTo(pathFixer('system/cache/')); $zip->close(); if (file_exists($folder)){ $step++; }else{ $msg = "Failed to extract update file"; $msgType = "danger"; $continue = false; } // remove downloaded zip if (file_exists($file)) unlink($file); }else if ($step == 3) { copyFolder($folder, pathFixer('./')); deleteFolder('install/'); deleteFolder($folder); if (!file_exists($folder.pathFixer('/system/'))){ $step++; }else{ $msg = "Failed to install update file."; $msgType = "danger"; $continue = false; } } function pathFixer($path) { return str_replace("/", DIRECTORY_SEPARATOR, $path); } function r2($to, $ntype = 'e', $msg = '') { if ($msg == '') { header("location: $to"); exit; } $_SESSION['ntype'] = $ntype; $_SESSION['notify'] = $msg; header("location: $to"); exit; } 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); rename($from . $file, $to . $file); } else if (is_dir($from . $file) && !in_array($file, ['.', '..'])) { if (!file_exists($to . $file)) { mkdir($to . $file); } copyFolder($from . $file . DIRECTORY_SEPARATOR, $to . $file . DIRECTORY_SEPARATOR); } } } function deleteFolder($path) { $files = scandir($path); foreach ($files as $file) { if (is_file($path . $file)) { unlink($path . $file); } else if (is_dir($path . $file) && !in_array($file, ['.', '..'])) { File::deleteFolder($path . $file . DIRECTORY_SEPARATOR); rmdir($path . $file); } } rmdir($path); } ?>