summaryrefslogtreecommitdiff
path: root/mod.php
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-03-21 22:04:58 +1100
committerMichael Save <savetheinternet@tinyboard.org>2012-03-21 22:04:58 +1100
commit29dc55c4e89c5bebfbca71d7867dbd126d3b36e2 (patch)
treea7fa7a65c6320f615995108ee8b6345e93563ab8 /mod.php
parentcf6bf2c7dcadd8c58ebae658d789c756d92585d1 (diff)
Close and unzip zip file upon errors (?/upgrade)
Diffstat (limited to 'mod.php')
-rw-r--r--mod.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/mod.php b/mod.php
index cedceb26..a7d57ffa 100644
--- a/mod.php
+++ b/mod.php
@@ -350,6 +350,8 @@
}
}
+ $zip->close();
+
if($errors) {
$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) {
@@ -357,6 +359,8 @@
}
$body .= '</ul><p>Please fix the above errors and refresh to try again.</p></div>';
+ unlink($temp);
+
echo Element('page.html', Array(
'config' => $config,
'title' => 'Error(s) upgrading',
@@ -365,13 +369,11 @@
exit;
}
- $zip->close();
-
// For some reason, reading the ZIP entries in PHP doesn't seem to work very well.
// 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');
- unlink($temp);
+ unlink($temp);
echo Element('page.html', Array(
'config' => $config,