Close and unzip zip file upon errors (?/upgrade)
This commit is contained in:
parent
cf6bf2c7dc
commit
29dc55c4e8
6
mod.php
6
mod.php
@ -350,6 +350,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$zip->close();
|
||||||
|
|
||||||
if($errors) {
|
if($errors) {
|
||||||
$body = '<div class="ban"><h2>Error(s) upgrading</h2><p>Tinyboard can not self-upgrade until the following is fixed:</p><ul>';
|
$body = '<div class="ban"><h2>Error(s) upgrading</h2><p>Tinyboard can not self-upgrade until the following is fixed:</p><ul>';
|
||||||
foreach($errors as $error) {
|
foreach($errors as $error) {
|
||||||
@ -357,6 +359,8 @@
|
|||||||
}
|
}
|
||||||
$body .= '</ul><p>Please fix the above errors and refresh to try again.</p></div>';
|
$body .= '</ul><p>Please fix the above errors and refresh to try again.</p></div>';
|
||||||
|
|
||||||
|
unlink($temp);
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', Array(
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
'title' => 'Error(s) upgrading',
|
'title' => 'Error(s) upgrading',
|
||||||
@ -365,8 +369,6 @@
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$zip->close();
|
|
||||||
|
|
||||||
// For some reason, reading the ZIP entries in PHP doesn't seem to work very well.
|
// For some reason, reading the ZIP entries in PHP doesn't seem to work very well.
|
||||||
// Use shell instead.
|
// Use shell instead.
|
||||||
shell_exec('TEMP_DIR=$(mktemp -d); unzip -q ' . escapeshellarg($temp) . ' -d $TEMP_DIR -x "' . escapeshellarg($dir) . 'inc/instance-config.php"; mv -v $TEMP_DIR/' . escapeshellarg($dir) . '* "' . getcwd() . '"; rm -rf $TEMP_DIR');
|
shell_exec('TEMP_DIR=$(mktemp -d); unzip -q ' . escapeshellarg($temp) . ' -d $TEMP_DIR -x "' . escapeshellarg($dir) . 'inc/instance-config.php"; mv -v $TEMP_DIR/' . escapeshellarg($dir) . '* "' . getcwd() . '"; rm -rf $TEMP_DIR');
|
||||||
|
Loading…
Reference in New Issue
Block a user