diff options
-rw-r--r-- | classes/dbupdater.php | 2 | ||||
-rwxr-xr-x | classes/handler/public.php | 2 | ||||
-rwxr-xr-x | update.php | 20 |
3 files changed, 17 insertions, 7 deletions
diff --git a/classes/dbupdater.php b/classes/dbupdater.php index 01c6a59f1..70cea881b 100644 --- a/classes/dbupdater.php +++ b/classes/dbupdater.php @@ -45,7 +45,7 @@ class DbUpdater { if ($html_output) print "<pre>$line</pre>"; else - print "\t$line\n"; + print " * $line\n"; if (strpos($line, "--") !== 0 && $line) { try { diff --git a/classes/handler/public.php b/classes/handler/public.php index f700afd79..a8f72e21c 100755 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -1133,7 +1133,7 @@ class Handler_Public extends Handler { if ($op == "performupdate") { if ($updater->isUpdateRequired()) { - print "<h2>" . T_sprintf("Performing updates to schema version %d", SCHEMA_VERSION) . "</h2>"; + print "<h2>" . T_sprintf("Performing updates to version %d", SCHEMA_VERSION) . "</h2>"; for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) { print "<ul>"; diff --git a/update.php b/update.php index 1dc2efd91..9526c839b 100755 --- a/update.php +++ b/update.php @@ -111,7 +111,7 @@ $schema_version = get_schema_version(); if ($schema_version != SCHEMA_VERSION) { - die("Schema version is wrong, please upgrade the database.\n"); + die("Schema version is wrong, please upgrade the database (--update-schema).\n"); } } @@ -326,20 +326,30 @@ if ($updater->isUpdateRequired()) { Debug::log("schema update required, version " . $updater->getSchemaVersion() . " to " . SCHEMA_VERSION); + + if (DB_TYPE == "mysql") + Debug::Log("READ THIS: Due to MySQL limitations, your database is not completely protected while updating.\n". + "Errors may put it in an inconsistent state requiring manual rollback.\nBACKUP YOUR DATABASE BEFORE CONTINUING."); + Debug::log("WARNING: please backup your database before continuing."); Debug::log("Type 'yes' to continue."); if (read_stdin() != 'yes') exit; + print "Performing updates to version " . SCHEMA_VERSION . "...\n"; + for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) { - Debug::log("performing update up to version $i..."); + Debug::log(" * Updating to version $i..."); $result = $updater->performUpdateTo($i, false); - Debug::log($result ? "OK!" : "FAILED!"); - - if (!$result) return; + if ($result) { + print " * Completed."; + } else { + print "One of the updates failed. Either retry the process or perform updates manually."; + return; + } } } else { |