Move DB_UPDATE_VERSION from boot.php to config/dbstructure.php

This commit is contained in:
Hypolite Petovan 2018-10-21 01:58:10 -04:00
parent fad99b8619
commit 19ffc0510b
5 changed files with 13 additions and 4 deletions

View File

@ -41,7 +41,6 @@ define('FRIENDICA_PLATFORM', 'Friendica');
define('FRIENDICA_CODENAME', 'The Tazmans Flax-lily');
define('FRIENDICA_VERSION', '2018.12-dev');
define('DFRN_PROTOCOL_VERSION', '2.23');
define('DB_UPDATE_VERSION', 1289);
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
/**

View File

@ -27,11 +27,16 @@
* ],
* ],
*
* If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value below.
*
*/
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1289);
}
return [
"addon" => [
"comment" => "registered addons",

View File

@ -573,7 +573,11 @@ class App
$stamp1 = microtime(true);
DBA::connect($db_host, $db_user, $db_pass, $db_data, $charset);
if (DBA::connect($db_host, $db_user, $db_pass, $db_data, $charset)) {
// Loads DB_UPDATE_VERSION constant
Database\DBStructure::definition();
}
unset($db_host, $db_user, $db_pass, $db_data, $charset);
$this->saveTimestamp($stamp1, 'network');

View File

@ -5,8 +5,8 @@
namespace Friendica\Database;
use Exception;
use Friendica\Core\Hook;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Util\DateTimeFormat;
@ -830,6 +830,7 @@ class DBStructure
/**
* Loads the database structure definition from the config/dbstructure.php file.
* On first pass, defines DB_UPDATE_VERSION constant.
*
* @see config/dbstructure.php
* @return array

View File

@ -32,7 +32,7 @@ require_once 'include/dba.php';
*
* 1. Create a function "update_4712()" here in the update.php
* 2. Apply the needed structural changes in config/dbStructure.php
* 3. Set DB_UPDATE_VERSION in boot.php to 4712.
* 3. Set DB_UPDATE_VERSION in config/dbstructure.php to 4712.
*
* If you need to run a script before the database update, name the function "pre_update_4712()"
*/