Old stuff had been removed from the update routine
This commit is contained in:
parent
98c2cdb49a
commit
1e7e83510a
2 changed files with 50 additions and 1645 deletions
85
boot.php
85
boot.php
|
@ -619,10 +619,17 @@ function is_ajax()
|
||||||
function check_db($via_worker)
|
function check_db($via_worker)
|
||||||
{
|
{
|
||||||
$build = Config::get('system', 'build');
|
$build = Config::get('system', 'build');
|
||||||
if (!x($build)) {
|
|
||||||
|
if (empty($build)) {
|
||||||
Config::set('system', 'build', DB_UPDATE_VERSION);
|
Config::set('system', 'build', DB_UPDATE_VERSION);
|
||||||
$build = DB_UPDATE_VERSION;
|
$build = DB_UPDATE_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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) {
|
if ($build != DB_UPDATE_VERSION) {
|
||||||
// When we cannot execute the database update via the worker, we will do it directly
|
// When we cannot execute the database update via the worker, we will do it directly
|
||||||
if (!Worker::add(PRIORITY_CRITICAL, 'DBUpdate') && $via_worker) {
|
if (!Worker::add(PRIORITY_CRITICAL, 'DBUpdate') && $via_worker) {
|
||||||
|
@ -647,7 +654,7 @@ function check_url(App $a)
|
||||||
// and www.example.com vs example.com.
|
// and www.example.com vs example.com.
|
||||||
// We will only change the url to an ip address if there is no existing setting
|
// We will only change the url to an ip address if there is no existing setting
|
||||||
|
|
||||||
if (!x($url)) {
|
if (empty($url)) {
|
||||||
$url = Config::set('system', 'url', System::baseUrl());
|
$url = Config::set('system', 'url', System::baseUrl());
|
||||||
}
|
}
|
||||||
if ((!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->get_hostname))) {
|
if ((!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->get_hostname))) {
|
||||||
|
@ -664,7 +671,8 @@ function check_url(App $a)
|
||||||
function update_db(App $a)
|
function update_db(App $a)
|
||||||
{
|
{
|
||||||
$build = Config::get('system', 'build');
|
$build = Config::get('system', 'build');
|
||||||
if (!x($build)) {
|
|
||||||
|
if (empty($build)) {
|
||||||
$build = Config::set('system', 'build', DB_UPDATE_VERSION);
|
$build = Config::set('system', 'build', DB_UPDATE_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,53 +682,32 @@ function update_db(App $a)
|
||||||
if ($stored < $current) {
|
if ($stored < $current) {
|
||||||
Config::load('database');
|
Config::load('database');
|
||||||
|
|
||||||
// We're reporting a different version than what is currently installed.
|
// Compare the current structure with the defined structure
|
||||||
// Run any existing update scripts to bring the database up to current.
|
$t = Config::get('database', 'dbupdate_' . DB_UPDATE_VERSION);
|
||||||
// make sure that boot.php and update.php are the same release, we might be
|
if (!is_null($t)) {
|
||||||
// updating right this very second and the correct version of the update.php
|
return;
|
||||||
// file may not be here yet. This can happen on a very busy site.
|
}
|
||||||
|
|
||||||
if (DB_UPDATE_VERSION == UPDATE_VERSION) {
|
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, time());
|
||||||
// Compare the current structure with the defined structure
|
|
||||||
|
|
||||||
$t = Config::get('database', 'dbupdate_' . DB_UPDATE_VERSION);
|
// run update routine
|
||||||
if (!is_null($t)) {
|
// it update the structure in one call
|
||||||
return;
|
$retval = DBStructure::update(false, true);
|
||||||
}
|
if ($retval) {
|
||||||
|
DBStructure::updateFail(
|
||||||
|
DB_UPDATE_VERSION,
|
||||||
|
$retval
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
|
||||||
|
}
|
||||||
|
|
||||||
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, time());
|
// run any left update_nnnn functions in update.php
|
||||||
|
for ($x = $stored; $x < $current; $x ++) {
|
||||||
// run old update routine (wich could modify the schema and
|
$r = run_update_function($x);
|
||||||
// conflits with new routine)
|
if (!$r) {
|
||||||
for ($x = $stored; $x < NEW_UPDATE_ROUTINE_VERSION; $x++) {
|
break;
|
||||||
$r = run_update_function($x);
|
|
||||||
if (!$r) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($stored < NEW_UPDATE_ROUTINE_VERSION) {
|
|
||||||
$stored = NEW_UPDATE_ROUTINE_VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
// run new update routine
|
|
||||||
// it update the structure in one call
|
|
||||||
$retval = DBStructure::update(false, true);
|
|
||||||
if ($retval) {
|
|
||||||
DBStructure::updateFail(
|
|
||||||
DB_UPDATE_VERSION,
|
|
||||||
$retval
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
|
|
||||||
}
|
|
||||||
|
|
||||||
// run any left update_nnnn functions in update.php
|
|
||||||
for ($x = $stored; $x < $current; $x ++) {
|
|
||||||
$r = run_update_function($x);
|
|
||||||
if (!$r) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -996,7 +983,7 @@ function remote_user()
|
||||||
if (local_user()) {
|
if (local_user()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((x($_SESSION, 'authenticated')) && (x($_SESSION, 'visitor_id'))) {
|
if (x($_SESSION, 'authenticated') && x($_SESSION, 'visitor_id')) {
|
||||||
return intval($_SESSION['visitor_id']);
|
return intval($_SESSION['visitor_id']);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1051,7 +1038,7 @@ function info($s)
|
||||||
function get_max_import_size()
|
function get_max_import_size()
|
||||||
{
|
{
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
return ((x($a->config, 'max_import_size')) ? $a->config['max_import_size'] : 0 );
|
return (x($a->config, 'max_import_size') ? $a->config['max_import_size'] : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
1610
update.php
1610
update.php
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue