summaryrefslogtreecommitdiff
path: root/update.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-02 15:03:01 +0300
committerAndrew Dolgov <[email protected]>2021-03-02 15:03:01 +0300
commitd6629ed18863f797d34ebdc65815d7af21cb8332 (patch)
treea72a114c576f2aa15710d18a8090a9bced9c56ba /update.php
parent86b12fc06c33fe742ac4035a031716674bdb6462 (diff)
move dbupdater to db/updater; move base SCHEMA_VERSION constant inside db/updater class
Diffstat (limited to 'update.php')
-rwxr-xr-xupdate.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/update.php b/update.php
index 63700cc0c..94a6bb5ca 100755
--- a/update.php
+++ b/update.php
@@ -146,7 +146,7 @@
}
if (!isset($options['update-schema'])) {
- if (get_schema_version() != SCHEMA_VERSION) {
+ if (Db_Updater::is_update_required()) {
die("Schema version is wrong, please upgrade the database (--update-schema).\n");
}
}
@@ -374,10 +374,10 @@
if (isset($options["update-schema"])) {
Debug::log("Checking for updates (" . Config::get(Config::DB_TYPE) . ")...");
- $updater = new DbUpdater(Db::pdo(), Config::get(Config::DB_TYPE), SCHEMA_VERSION);
+ $updater = new Db_Updater(Db::pdo(), Config::get(Config::DB_TYPE));
- if ($updater->is_update_required()) {
- Debug::log("Schema update required, version " . $updater->get_schema_version() . " to " . SCHEMA_VERSION);
+ if (Db_Updater::is_update_required()) {
+ Debug::log("Schema update required, version " . Config::get_schema_version(true) . " to " . Db_Updater::SCHEMA_VERSION);
if (Config::get(Config::DB_TYPE) == "mysql")
Debug::Log("READ THIS: Due to MySQL limitations, your database is not completely protected while updating.\n".
@@ -394,9 +394,9 @@
Debug::log("Proceeding to update without confirmation...");
}
- Debug::log("Performing updates to version " . SCHEMA_VERSION . "...");
+ Debug::log("Performing updates to version " . Db_Updater::SCHEMA_VERSION . "...");
- for ($i = $updater->get_schema_version() + 1; $i <= SCHEMA_VERSION; $i++) {
+ for ($i = Config::get_schema_version(true) + 1; $i <= Db_Updater::SCHEMA_VERSION; $i++) {
Debug::log("* Updating to version $i...");
$result = $updater->update_to($i, false);