summaryrefslogtreecommitdiff
path: root/install.php
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-03-28 16:24:33 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2011-03-28 16:24:33 +1100
commit4555c4bf6af6283ce16147e079c722186fa39f00 (patch)
tree4f375c2d8bd0158164088386be49ab36e513c46c /install.php
parent60591625a377bb3d79d4be6fb62c490dd342b02b (diff)
more error handling (specifically SQL errors) in install.php
Diffstat (limited to 'install.php')
-rw-r--r--install.php21
1 files changed, 18 insertions, 3 deletions
diff --git a/install.php b/install.php
index de318c3a..7d90b523 100644
--- a/install.php
+++ b/install.php
@@ -310,8 +310,10 @@
preg_match_all("/((SET|CREATE|INSERT).+)\n\n/msU", $sql, $queries);
$queries = $queries[1];
+ $sql_errors = '';
foreach($queries as &$query) {
- query($query) or error(db_error());
+ if(!query($query))
+ $sql_errors .= '<li>' . db_error() . '</li>';
}
$boards = listBoards();
@@ -322,13 +324,26 @@
sql_close();
- touch($config['has_installed'], 0777);
+ $page['title'] = 'Installation complete';
+ $page['body'] = '<p style="text-align:center">Thank you for using Tinyboard. Please remember to report any bugs you discover.</p>';
+ if(!empty($sql_errors)) {
+ $page['body'] .= '<div class="ban"><h2>SQL errors</h2><p>SQL errors were encountered when trying to install the database. This may be the result of using a database which is already occupied with a Tinyboard installation; if so, you can probably ignore this.</p><p>The errors encountered were:</p><ul>' . $sql_errors . '</ul><p><a href="?step=5">Ignore errors and complete installation.</a></p></div>';
+ } else {
+ touch($config['has_installed'], 0777);
+ if(!@unlink(__FILE__)) {
+ $page['body'] .= '<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';
+ }
+ }
+
+ echo Element('page.html', $page);
+ } elseif($step == 5) {
$page['title'] = 'Installation complete';
$page['body'] = '<p style="text-align:center">Thank you for using Tinyboard. Please remember to report any bugs you discover.</p>';
+ touch($config['has_installed'], 0777);
if(!@unlink(__FILE__)) {
- $page['body'] = '<p style="text-align:center">I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p>';
+ $page['body'] .= '<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';
}
echo Element('page.html', $page);