diff options
Diffstat (limited to 'Zotlabs/Lib/DB_Upgrade.php')
-rw-r--r-- | Zotlabs/Lib/DB_Upgrade.php | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/Zotlabs/Lib/DB_Upgrade.php b/Zotlabs/Lib/DB_Upgrade.php index b6e3f7b7b..981c354a4 100644 --- a/Zotlabs/Lib/DB_Upgrade.php +++ b/Zotlabs/Lib/DB_Upgrade.php @@ -2,6 +2,7 @@ namespace Zotlabs\Lib; +use Zotlabs\Lib\Config; class DB_Upgrade { @@ -13,9 +14,9 @@ class DB_Upgrade { $this->config_name = 'db_version'; $this->func_prefix = '_'; - $build = get_config('system', 'db_version', 0); + $build = Config::Get('system', 'db_version', 0); if(! intval($build)) - $build = set_config('system', 'db_version', $db_revision); + $build = Config::Set('system', 'db_version', $db_revision); if($build == $db_revision) { // Nothing to be done. @@ -27,7 +28,7 @@ class DB_Upgrade { logger('Critical: check_config unable to determine database schema version'); return; } - + $current = intval($db_revision); if($stored < $current) { @@ -38,7 +39,7 @@ class DB_Upgrade { for($x = $stored + 1; $x <= $current; $x ++) { $s = '_' . $x; $cls = '\\Zotlabs\Update\\' . $s ; - if(! class_exists($cls)) { + if(! class_exists($cls)) { return; } @@ -52,10 +53,10 @@ class DB_Upgrade { Config::Load('database'); - if(get_config('database', $s)) + if(Config::Get('database', $s)) break; - set_config('database',$s, '1'); - + Config::Set('database',$s, '1'); + $c = new $cls(); @@ -65,10 +66,10 @@ class DB_Upgrade { $source = t('Source code of failed update: ') . "\n\n" . @file_get_contents('Zotlabs/Update/' . $s . '.php'); - + // Prevent sending hundreds of thousands of emails by creating - // a lockfile. + // a lockfile. $lockfile = 'store/[data]/mailsent'; @@ -77,7 +78,7 @@ class DB_Upgrade { @unlink($lockfile); //send the administrator an e-mail file_put_contents($lockfile, $x); - + $r = q("select account_language from account where account_email = '%s' limit 1", dbesc(\App::$config['system']['admin_email']) ); @@ -86,7 +87,7 @@ class DB_Upgrade { [ 'toEmail' => \App::$config['system']['admin_email'], 'messageSubject' => sprintf( t('Update Error at %s'), z_root()), - 'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'), + 'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'), [ '$sitename' => \App::$config['system']['sitename'], '$siteurl' => z_root(), @@ -104,11 +105,11 @@ class DB_Upgrade { pop_lang(); } else { - set_config('database',$s, 'success'); + Config::Set('database',$s, 'success'); } } } - set_config('system', 'db_version', $db_revision); + Config::Set('system', 'db_version', $db_revision); } } -}
\ No newline at end of file +} |