|
|
@ -320,40 +320,41 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($options["update-schema"])) {
|
|
|
|
if (isset($options["update-schema"])) {
|
|
|
|
Debug::log("checking for updates (" . DB_TYPE . ")...");
|
|
|
|
Debug::log("Checking for updates (" . DB_TYPE . ")...");
|
|
|
|
|
|
|
|
|
|
|
|
$updater = new DbUpdater(Db::pdo(), DB_TYPE, SCHEMA_VERSION);
|
|
|
|
$updater = new DbUpdater(Db::pdo(), DB_TYPE, SCHEMA_VERSION);
|
|
|
|
|
|
|
|
|
|
|
|
if ($updater->isUpdateRequired()) {
|
|
|
|
if ($updater->isUpdateRequired()) {
|
|
|
|
Debug::log("schema update required, version " . $updater->getSchemaVersion() . " to " . SCHEMA_VERSION);
|
|
|
|
Debug::log("Schema update required, version " . $updater->getSchemaVersion() . " to " . SCHEMA_VERSION);
|
|
|
|
|
|
|
|
|
|
|
|
if (DB_TYPE == "mysql")
|
|
|
|
if (DB_TYPE == "mysql")
|
|
|
|
Debug::Log("READ THIS: Due to MySQL limitations, your database is not completely protected while updating.\n".
|
|
|
|
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.");
|
|
|
|
"Errors may put it in an inconsistent state requiring manual rollback.\nBACKUP YOUR DATABASE BEFORE CONTINUING.");
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
Debug::log("WARNING: please backup your database before continuing.");
|
|
|
|
|
|
|
|
|
|
|
|
Debug::log("WARNING: please backup your database before continuing.");
|
|
|
|
|
|
|
|
Debug::log("Type 'yes' to continue.");
|
|
|
|
Debug::log("Type 'yes' to continue.");
|
|
|
|
|
|
|
|
|
|
|
|
if (read_stdin() != 'yes')
|
|
|
|
if (read_stdin() != 'yes')
|
|
|
|
exit;
|
|
|
|
exit;
|
|
|
|
|
|
|
|
|
|
|
|
print "Performing updates to version " . SCHEMA_VERSION . "...\n";
|
|
|
|
Debug::log("Performing updates to version " . SCHEMA_VERSION);
|
|
|
|
|
|
|
|
|
|
|
|
for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) {
|
|
|
|
for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) {
|
|
|
|
Debug::log(" * Updating to version $i...");
|
|
|
|
Debug::log("* Updating to version $i...");
|
|
|
|
|
|
|
|
|
|
|
|
$result = $updater->performUpdateTo($i, false);
|
|
|
|
$result = $updater->performUpdateTo($i, false);
|
|
|
|
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
if ($result) {
|
|
|
|
print " * Completed.";
|
|
|
|
Debug::log("* Completed.");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
print "One of the updates failed. Either retry the process or perform updates manually.";
|
|
|
|
Debug::log("One of the updates failed. Either retry the process or perform updates manually.");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Debug::log("update not required.");
|
|
|
|
Debug::log("Update not required.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|