aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-03-23 21:49:20 -0700
committerzotlabs <mike@macgirvin.com>2017-03-23 21:49:20 -0700
commita2e101997836ebd904e94aa896a1bcc2e2c70f01 (patch)
tree76daffc0d41801dc825ffba6538d6c5022e4c311 /boot.php
parente98938d03dbdd94c33419924a50e4b6fbeb6fe1c (diff)
downloadvolse-hubzilla-a2e101997836ebd904e94aa896a1bcc2e2c70f01.tar.gz
volse-hubzilla-a2e101997836ebd904e94aa896a1bcc2e2c70f01.tar.bz2
volse-hubzilla-a2e101997836ebd904e94aa896a1bcc2e2c70f01.zip
move db_upgrade to zlib
Diffstat (limited to 'boot.php')
-rwxr-xr-xboot.php90
1 files changed, 3 insertions, 87 deletions
diff --git a/boot.php b/boot.php
index e0c0bc94e..63df8b3b0 100755
--- a/boot.php
+++ b/boot.php
@@ -1357,11 +1357,7 @@ function is_ajax() {
// base url for use in cmdline programs which don't have
// $_SERVER variables, and synchronising the state of installed plugins.
-function check_config(&$a) {
-
- $build = get_config('system','db_version');
- if(! intval($build))
- $build = set_config('system','db_version',DB_UPDATE_VERSION);
+function check_config() {
$saved = get_config('system','urlverify');
if(! $saved)
@@ -1399,88 +1395,8 @@ function check_config(&$a) {
if (! $syschan_exists)
create_sys_channel();
- if($build != DB_UPDATE_VERSION) {
- $stored = intval($build);
- if(! $stored) {
- logger('Critical: check_config unable to determine database schema version');
- return;
- }
- $current = intval(DB_UPDATE_VERSION);
- if(($stored < $current) && file_exists('install/update.php')) {
-
- load_config('database');
-
- // We're reporting a different version than what is currently installed.
- // Run any existing update scripts to bring the database up to current.
- require_once('install/update.php');
-
- // make sure that boot.php and update.php are the same release, we might be
- // updating right this very second and the correct version of the update.php
- // file may not be here yet. This can happen on a very busy site.
-
- if(DB_UPDATE_VERSION == UPDATE_VERSION) {
- for($x = $stored; $x < $current; $x ++) {
- if(function_exists('update_r' . $x)) {
- // There could be a lot of processes running or about to run.
- // We want exactly one process to run the update command.
- // So store the fact that we're taking responsibility
- // after first checking to see if somebody else already has.
-
- // If the update fails or times-out completely you may need to
- // delete the config entry to try again.
-
- if(get_config('database','update_r' . $x))
- break;
- set_config('database','update_r' . $x, '1');
- // call the specific update
-
- $func = 'update_r' . $x;
- $retval = $func();
- if($retval) {
-
- // Prevent sending hundreds of thousands of emails by creating
- // a lockfile.
-
- $lockfile = 'store/[data]/mailsent';
-
- if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 86400)))
- return;
- @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'])
- );
- push_lang(($r) ? $r[0]['account_language'] : 'en');
-
-
- $email_tpl = get_intltext_template("update_fail_eml.tpl");
- $email_msg = replace_macros($email_tpl, array(
- '$sitename' => App::$config['system']['sitename'],
- '$siteurl' => z_root(),
- '$update' => $x,
- '$error' => sprintf( t('Update %s failed. See error logs.'), $x)
- ));
-
- $subject = email_header_encode(sprintf(t('Update Error at %s'), z_root()));
-
- mail(App::$config['system']['admin_email'], $subject, $email_msg,
- 'From: Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"
- . 'Content-type: text/plain; charset=UTF-8' . "\n"
- . 'Content-transfer-encoding: 8bit' );
- //try the logger
- logger('CRITICAL: Update Failed: ' . $x);
- pop_lang();
- }
- else
- set_config('database','update_r' . $x, 'success');
- }
- }
- set_config('system','db_version', DB_UPDATE_VERSION);
- }
- }
- }
+ $x = new \Zotlabs\Lib\DB_Upgrade(DB_UPDATE_VERSION);
+
/**
*