diff options
author | Mario <mario@mariovavti.com> | 2024-10-30 11:47:52 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-10-30 11:47:52 +0000 |
commit | 90a1dad02c24dcb3bc629e198ad24adc0b7566d3 (patch) | |
tree | 89de123ebf37adf8e6830370a4387872eb76136e /Zotlabs | |
parent | 0207c024201eec8d3fe83d4151f8cb5165e28886 (diff) | |
parent | 8f4c3a2f88d3770e6cfebaa61671f54fa17a34e1 (diff) | |
download | volse-hubzilla-90a1dad02c24dcb3bc629e198ad24adc0b7566d3.tar.gz volse-hubzilla-90a1dad02c24dcb3bc629e198ad24adc0b7566d3.tar.bz2 volse-hubzilla-90a1dad02c24dcb3bc629e198ad24adc0b7566d3.zip |
Merge branch 'make-db-upgrade-static-method' into 'dev'
Change DB_Upgrade to a static function instead.
See merge request hubzilla/core!2151
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Lib/DB_Upgrade.php | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/Zotlabs/Lib/DB_Upgrade.php b/Zotlabs/Lib/DB_Upgrade.php index 981c354a4..e11c2eb10 100644 --- a/Zotlabs/Lib/DB_Upgrade.php +++ b/Zotlabs/Lib/DB_Upgrade.php @@ -1,18 +1,35 @@ <?php +/** + * A class to handle database schema upgrades. + * + * SPDX-FileCopyrightText: 2024 Hubzilla Community + * SPDX-FileContributor: Harald Eilertsen + * + * SPDX-License-Identifier: MIT + */ namespace Zotlabs\Lib; use Zotlabs\Lib\Config; +/** + * Upgrade the database schema if necessary. + * + * Compares the currently active database schema version with the version + * required for this version of Hubzilla, and performs the upgrade if needed. + * + * If the difference consists of more than one revision of the schema, each of + * the intermediate upgrades are performed in turn. + */ class DB_Upgrade { - public $config_name = ''; - public $func_prefix = ''; - - function __construct($db_revision) { - - $this->config_name = 'db_version'; - $this->func_prefix = '_'; + /** + * Check the installed and required schema versions and perform the upgrade + * if necessary. + * + * @param int $db_version The required DB schema version. + */ + public static function run(int $db_revision): void { $build = Config::Get('system', 'db_version', 0); if(! intval($build)) |