moved check_db($via_worker) to Update::check($via_worker)
This commit is contained in:
parent
87f3fe24f7
commit
ffbad2dc81
|
@ -7,6 +7,7 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
|
use Friendica\Core\Update;
|
||||||
|
|
||||||
// Get options
|
// Get options
|
||||||
$shortopts = 'sn';
|
$shortopts = 'sn';
|
||||||
|
@ -30,7 +31,7 @@ require_once "boot.php";
|
||||||
$a = new App(dirname(__DIR__));
|
$a = new App(dirname(__DIR__));
|
||||||
|
|
||||||
// Check the database structure and possibly fixes it
|
// Check the database structure and possibly fixes it
|
||||||
check_db(true);
|
Update::check(true);
|
||||||
|
|
||||||
// Quit when in maintenance
|
// Quit when in maintenance
|
||||||
if (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED)) {
|
if (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED)) {
|
||||||
|
|
27
boot.php
27
boot.php
|
@ -413,33 +413,6 @@ function defaults() {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Function to check if request was an AJAX (xmlhttprequest) request.
|
|
||||||
*
|
|
||||||
* @param boolean $via_worker boolean Is the check run via the worker?
|
|
||||||
*/
|
|
||||||
function check_db($via_worker)
|
|
||||||
{
|
|
||||||
$build = Config::get('system', 'build');
|
|
||||||
|
|
||||||
if (empty($build)) {
|
|
||||||
Config::set('system', 'build', DB_UPDATE_VERSION - 1);
|
|
||||||
$build = DB_UPDATE_VERSION - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't support upgrading from very old versions anymore
|
|
||||||
if ($build < NEW_UPDATE_ROUTINE_VERSION) {
|
|
||||||
die('You try to update from a version prior to database version 1170. The direct upgrade path is not supported. Please update to version 3.5.4 before updating to this version.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($build < DB_UPDATE_VERSION) {
|
|
||||||
// When we cannot execute the database update via the worker, we will do it directly
|
|
||||||
if (!Worker::add(PRIORITY_CRITICAL, 'DBUpdate') && $via_worker) {
|
|
||||||
Update::run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Automatic database updates
|
* @brief Automatic database updates
|
||||||
* @param object $a App
|
* @param object $a App
|
||||||
|
|
|
@ -9,6 +9,33 @@ class Update
|
||||||
const SUCCESS = 0;
|
const SUCCESS = 0;
|
||||||
const FAILED = 1;
|
const FAILED = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function to check if the Database structure needs an update.
|
||||||
|
*
|
||||||
|
* @param boolean $via_worker boolean Is the check run via the worker?
|
||||||
|
*/
|
||||||
|
public static function check($via_worker)
|
||||||
|
{
|
||||||
|
$build = Config::get('system', 'build');
|
||||||
|
|
||||||
|
if (empty($build)) {
|
||||||
|
Config::set('system', 'build', DB_UPDATE_VERSION - 1);
|
||||||
|
$build = DB_UPDATE_VERSION - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't support upgrading from very old versions anymore
|
||||||
|
if ($build < NEW_UPDATE_ROUTINE_VERSION) {
|
||||||
|
die('You try to update from a version prior to database version 1170. The direct upgrade path is not supported. Please update to version 3.5.4 before updating to this version.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($build < DB_UPDATE_VERSION) {
|
||||||
|
// When we cannot execute the database update via the worker, we will do it directly
|
||||||
|
if (!Worker::add(PRIORITY_CRITICAL, 'DBUpdate') && $via_worker) {
|
||||||
|
self::run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatic database updates
|
* Automatic database updates
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user