aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2024-10-30 12:50:08 +0100
committerMario Vavti <mario@mariovavti.com>2024-10-30 12:50:08 +0100
commit005d4ad35143e417b7c1dbfbf38417dee03e9608 (patch)
tree26ca21abd63168b3ddbd0f963f6f2473ac11eeab /Zotlabs/Lib
parent68135c28da286bb23978f6181c46edf56c37b06e (diff)
parent90a1dad02c24dcb3bc629e198ad24adc0b7566d3 (diff)
downloadvolse-hubzilla-005d4ad35143e417b7c1dbfbf38417dee03e9608.tar.gz
volse-hubzilla-005d4ad35143e417b7c1dbfbf38417dee03e9608.tar.bz2
volse-hubzilla-005d4ad35143e417b7c1dbfbf38417dee03e9608.zip
Merge branch 'dev' into containers
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/DB_Upgrade.php31
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))