remove print_r
This commit is contained in:
parent
1111ea986e
commit
62c3002152
@ -6,7 +6,6 @@ class File
|
|||||||
public static function copyFolder($from, $to, $exclude = [])
|
public static function copyFolder($from, $to, $exclude = [])
|
||||||
{
|
{
|
||||||
$files = scandir($from);
|
$files = scandir($from);
|
||||||
print_r($files);
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (is_file($from . $file) && !in_array($file, $exclude)) {
|
if (is_file($from . $file) && !in_array($file, $exclude)) {
|
||||||
if (file_exists($to . $file)) unlink($to . $file);
|
if (file_exists($to . $file)) unlink($to . $file);
|
||||||
|
93
update.php
93
update.php
@ -33,9 +33,9 @@ if (!extension_loaded('zip')) {
|
|||||||
|
|
||||||
$file = pathFixer('system/cache/phpnuxbill.zip');
|
$file = pathFixer('system/cache/phpnuxbill.zip');
|
||||||
$folder = pathFixer('system/cache/phpnuxbill-master');
|
$folder = pathFixer('system/cache/phpnuxbill-master');
|
||||||
if(empty($step)){
|
if (empty($step)) {
|
||||||
$step++;
|
$step++;
|
||||||
}else if ($step == 1) {
|
} else if ($step == 1) {
|
||||||
if (file_exists($file)) unlink($file);
|
if (file_exists($file)) unlink($file);
|
||||||
|
|
||||||
// Download update
|
// Download update
|
||||||
@ -50,39 +50,39 @@ if(empty($step)){
|
|||||||
curl_exec($ch);
|
curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
if (file_exists($file)){
|
if (file_exists($file)) {
|
||||||
$step++;
|
$step++;
|
||||||
}else{
|
} else {
|
||||||
$msg = "Failed to download Update file";
|
$msg = "Failed to download Update file";
|
||||||
$msgType = "danger";
|
$msgType = "danger";
|
||||||
$continue = false;
|
$continue = false;
|
||||||
}
|
}
|
||||||
}else if ($step == 2) {
|
} else if ($step == 2) {
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
$zip->open($file);
|
$zip->open($file);
|
||||||
$zip->extractTo(pathFixer('system/cache/'));
|
$zip->extractTo(pathFixer('system/cache/'));
|
||||||
$zip->close();
|
$zip->close();
|
||||||
if (file_exists($folder)){
|
if (file_exists($folder)) {
|
||||||
$step++;
|
$step++;
|
||||||
}else{
|
} else {
|
||||||
$msg = "Failed to extract update file";
|
$msg = "Failed to extract update file";
|
||||||
$msgType = "danger";
|
$msgType = "danger";
|
||||||
$continue = false;
|
$continue = false;
|
||||||
}
|
}
|
||||||
// remove downloaded zip
|
// remove downloaded zip
|
||||||
if (file_exists($file)) unlink($file);
|
if (file_exists($file)) unlink($file);
|
||||||
}else if ($step == 3) {
|
} else if ($step == 3) {
|
||||||
copyFolder($folder, pathFixer('./'));
|
copyFolder($folder, pathFixer('./'));
|
||||||
deleteFolder('install/');
|
deleteFolder('install/');
|
||||||
deleteFolder($folder);
|
deleteFolder($folder);
|
||||||
if (!file_exists($folder.pathFixer('/system/'))){
|
if (!file_exists($folder . pathFixer('/system/'))) {
|
||||||
$step++;
|
$step++;
|
||||||
}else{
|
} else {
|
||||||
$msg = "Failed to install update file.";
|
$msg = "Failed to install update file.";
|
||||||
$msgType = "danger";
|
$msgType = "danger";
|
||||||
$continue = false;
|
$continue = false;
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
$version = json_decode(file_get_contents('version.json'), true)['version'];
|
$version = json_decode(file_get_contents('version.json'), true)['version'];
|
||||||
$continue = false;
|
$continue = false;
|
||||||
}
|
}
|
||||||
@ -107,7 +107,6 @@ function r2($to, $ntype = 'e', $msg = '')
|
|||||||
function copyFolder($from, $to, $exclude = [])
|
function copyFolder($from, $to, $exclude = [])
|
||||||
{
|
{
|
||||||
$files = scandir($from);
|
$files = scandir($from);
|
||||||
print_r($files);
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (is_file($from . $file) && !in_array($file, $exclude)) {
|
if (is_file($from . $file) && !in_array($file, $exclude)) {
|
||||||
if (file_exists($to . $file)) unlink($to . $file);
|
if (file_exists($to . $file)) unlink($to . $file);
|
||||||
@ -127,7 +126,7 @@ function deleteFolder($path)
|
|||||||
if (is_file($path . $file)) {
|
if (is_file($path . $file)) {
|
||||||
unlink($path . $file);
|
unlink($path . $file);
|
||||||
} else if (is_dir($path . $file) && !in_array($file, ['.', '..'])) {
|
} else if (is_dir($path . $file) && !in_array($file, ['.', '..'])) {
|
||||||
File::deleteFolder($path . $file . DIRECTORY_SEPARATOR);
|
deleteFolder($path . $file . DIRECTORY_SEPARATOR);
|
||||||
rmdir($path . $file);
|
rmdir($path . $file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,8 +151,8 @@ function deleteFolder($path)
|
|||||||
|
|
||||||
<link rel="stylesheet" href="ui/ui/styles/adminlte.min.css">
|
<link rel="stylesheet" href="ui/ui/styles/adminlte.min.css">
|
||||||
<link rel="stylesheet" href="ui/ui/styles/skin-blue.min.css">
|
<link rel="stylesheet" href="ui/ui/styles/skin-blue.min.css">
|
||||||
<?php if($continue){ ?>
|
<?php if ($continue) { ?>
|
||||||
<meta http-equiv="refresh" content="1; ./update.php?step=<?=$step?>">
|
<meta http-equiv="refresh" content="1; ./update.php?step=<?= $step ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<style>
|
<style>
|
||||||
::-moz-selection {
|
::-moz-selection {
|
||||||
@ -182,43 +181,45 @@ function deleteFolder($path)
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4"></div>
|
<div class="col-md-4"></div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<?php if(!empty($msgType) && !empty($msg)) { ?>
|
<?php if (!empty($msgType) && !empty($msg)) { ?>
|
||||||
<div class="alert alert-<?=$msgType?>" role="alert">
|
<div class="alert alert-<?= $msgType ?>" role="alert">
|
||||||
<?=$msg?>
|
<?= $msg ?>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if($step==1) { ?>
|
<?php if ($continue) { ?>
|
||||||
<div class="panel panel-primary">
|
<?php if ($step == 1) { ?>
|
||||||
<div class="panel-heading">Step 1</div>
|
<div class="panel panel-primary">
|
||||||
<div class="panel-body">
|
<div class="panel-heading">Step 1</div>
|
||||||
Downloading update<br>
|
<div class="panel-body">
|
||||||
Please wait....
|
Downloading update<br>
|
||||||
|
Please wait....
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<?php } else if ($step == 2) { ?>
|
||||||
<?php }else if($step==2) { ?>
|
<div class="panel panel-primary">
|
||||||
<div class="panel panel-primary">
|
<div class="panel-heading">Step 2</div>
|
||||||
<div class="panel-heading">Step 2</div>
|
<div class="panel-body">
|
||||||
<div class="panel-body">
|
extracting<br>
|
||||||
extracting<br>
|
Please wait....
|
||||||
Please wait....
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<?php } else if ($step == 3) { ?>
|
||||||
<?php }else if($step==3) { ?>
|
<div class="panel panel-primary">
|
||||||
<div class="panel panel-primary">
|
<div class="panel-heading">Step 3</div>
|
||||||
<div class="panel-heading">Step 3</div>
|
<div class="panel-body">
|
||||||
<div class="panel-body">
|
Installing<br>
|
||||||
Installing<br>
|
Please wait....
|
||||||
Please wait....
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<?php } else if ($step == 4) { ?>
|
||||||
<?php }else if($step==4) { ?>
|
<div class="panel panel-primary">
|
||||||
<div class="panel panel-primary">
|
<div class="panel-success">Update Finished</div>
|
||||||
<div class="panel-success">Update Finished</div>
|
<div class="panel-body">
|
||||||
<div class="panel-body">
|
PHPNuxBill has been updated to Version <b><?= $version ?></b>
|
||||||
PHPNuxBill has been updated to Version <b><?=$version?></b>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<meta http-equiv="refresh" content="5; ./index.php?_route=dashboard">
|
||||||
<meta http-equiv="refresh" content="5; ./index.php?_route=dashboard">
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user