safer installation

This commit is contained in:
Michael Foster 2013-08-20 17:43:21 +10:00
parent abfdd38e59
commit 86801e2ef2

View File

@ -645,18 +645,18 @@ if ($step == 0) {
$sql_errors .= '<li>' . db_error() . '</li>'; $sql_errors .= '<li>' . db_error() . '</li>';
} }
$boards = listBoards();
foreach ($boards as &$_board) {
setupBoard($_board);
buildIndex();
}
$page['title'] = 'Installation complete'; $page['title'] = 'Installation complete';
$page['body'] = '<p style="text-align:center">Thank you for using Tinyboard. Please remember to report any bugs you discover. <a href="http://tinyboard.org/docs/?p=Config">How do I edit the config files?</a></p>'; $page['body'] = '<p style="text-align:center">Thank you for using Tinyboard. Please remember to report any bugs you discover. <a href="http://tinyboard.org/docs/?p=Config">How do I edit the config files?</a></p>';
if (!empty($sql_errors)) { 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>'; $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 { } else {
$boards = listBoards();
foreach ($boards as &$_board) {
setupBoard($_board);
buildIndex();
}
file_write($config['has_installed'], VERSION); file_write($config['has_installed'], VERSION);
if (!file_unlink(__FILE__)) { if (!file_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>'; $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>';
@ -668,6 +668,12 @@ if ($step == 0) {
$page['title'] = 'Installation complete'; $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>'; $page['body'] = '<p style="text-align:center">Thank you for using Tinyboard. Please remember to report any bugs you discover.</p>';
$boards = listBoards();
foreach ($boards as &$_board) {
setupBoard($_board);
buildIndex();
}
file_write($config['has_installed'], VERSION); file_write($config['has_installed'], VERSION);
if (!file_unlink(__FILE__)) { if (!file_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>'; $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>';