extract auto-update archive to correct folder regardless of the folder being named 'froxlor' or not, future auto-update archives will not have the froxlor-folder prefixed, fixes #1645
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -85,7 +85,7 @@ if ($page == 'overview') {
|
|||||||
}
|
}
|
||||||
elseif ($isnewerversion == 0) {
|
elseif ($isnewerversion == 0) {
|
||||||
// all good
|
// all good
|
||||||
standard_success ('noupdatesavail');
|
standard_success ('noupdatesavail');
|
||||||
} else {
|
} else {
|
||||||
standard_error ('customized_version');
|
standard_error ('customized_version');
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ elseif ($page == 'getdownload') {
|
|||||||
|
|
||||||
// remove old archive
|
// remove old archive
|
||||||
if (file_exists($localArchive)) {
|
if (file_exists($localArchive)) {
|
||||||
@unlink($localArchive);
|
@unlink($localArchive);
|
||||||
}
|
}
|
||||||
|
|
||||||
// store archive
|
// store archive
|
||||||
@@ -137,15 +137,15 @@ elseif ($page == 'getdownload') {
|
|||||||
// validate the integrity of the downloaded file
|
// validate the integrity of the downloaded file
|
||||||
$_shouldsum = @file_get_contents($toCheck);
|
$_shouldsum = @file_get_contents($toCheck);
|
||||||
if (!empty($_shouldsum)) {
|
if (!empty($_shouldsum)) {
|
||||||
$_t = explode(" ", $_shouldsum);
|
$_t = explode(" ", $_shouldsum);
|
||||||
$shouldsum = $_t[0];
|
$shouldsum = $_t[0];
|
||||||
} else {
|
} else {
|
||||||
$shouldsum = null;
|
$shouldsum = null;
|
||||||
}
|
}
|
||||||
$filesum = hash_file('sha256', $localArchive);
|
$filesum = hash_file('sha256', $localArchive);
|
||||||
|
|
||||||
if ($filesum != $shouldsum) {
|
if ($filesum != $shouldsum) {
|
||||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 9));
|
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 9));
|
||||||
}
|
}
|
||||||
|
|
||||||
// to the next step
|
// to the next step
|
||||||
@@ -166,8 +166,8 @@ elseif ($page == 'extract') {
|
|||||||
$zip = new ZipArchive;
|
$zip = new ZipArchive;
|
||||||
$res = $zip->open($localArchive);
|
$res = $zip->open($localArchive);
|
||||||
if ($res === true) {
|
if ($res === true) {
|
||||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "Extracting ".$localArchive." to ".dirname(FROXLOR_INSTALL_DIR));
|
$log->logAction(ADM_ACTION, LOG_NOTICE, "Extracting ".$localArchive." to ".FROXLOR_INSTALL_DIR);
|
||||||
$zip->extractTo(dirname(FROXLOR_INSTALL_DIR));
|
$zip->extractTo(FROXLOR_INSTALL_DIR);
|
||||||
$zip->close();
|
$zip->close();
|
||||||
// success - remove unused archive
|
// success - remove unused archive
|
||||||
@unlink($localArchive);
|
@unlink($localArchive);
|
||||||
|
|||||||
Reference in New Issue
Block a user