mirror of
https://github.com/friendica/friendica
synced 2024-12-22 18:00:16 +00:00
Class moved, changes applied
This commit is contained in:
parent
ab80e6d92a
commit
15d42de647
7 changed files with 31 additions and 31 deletions
16
boot.php
16
boot.php
|
@ -28,6 +28,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Database\DBStructure;
|
||||
|
||||
require_once 'include/network.php';
|
||||
require_once 'include/plugin.php';
|
||||
|
@ -37,13 +38,20 @@ require_once 'include/pgettext.php';
|
|||
require_once 'include/nav.php';
|
||||
require_once 'include/identity.php';
|
||||
require_once 'update.php';
|
||||
require_once 'include/dbstructure.php';
|
||||
|
||||
define('FRIENDICA_PLATFORM', 'Friendica');
|
||||
define('FRIENDICA_CODENAME', 'Asparagus');
|
||||
define('FRIENDICA_VERSION', '3.6-dev');
|
||||
define('DFRN_PROTOCOL_VERSION', '2.23');
|
||||
define('DB_UPDATE_VERSION', 1236);
|
||||
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
|
||||
|
||||
/**
|
||||
* @brief Constants for the database update check
|
||||
*/
|
||||
const DB_UPDATE_NOT_CHECKED = 0; // Database check wasn't executed before
|
||||
const DB_UPDATE_SUCCESSFUL = 1; // Database check was successful
|
||||
const DB_UPDATE_FAILED = 2; // Database check failed
|
||||
|
||||
/**
|
||||
* @brief Constant with a HTML line break.
|
||||
|
@ -694,9 +702,9 @@ function update_db(App $a)
|
|||
|
||||
// run new update routine
|
||||
// it update the structure in one call
|
||||
$retval = update_structure(false, true);
|
||||
$retval = DBStructure::updateStructure(false, true);
|
||||
if ($retval) {
|
||||
update_fail(
|
||||
DBStructure::updateFail(
|
||||
DB_UPDATE_VERSION,
|
||||
$retval
|
||||
);
|
||||
|
@ -742,7 +750,7 @@ function run_update_function($x)
|
|||
|
||||
if ($retval) {
|
||||
//send the administrator an e-mail
|
||||
update_fail(
|
||||
DBStructure::updateFail(
|
||||
$x,
|
||||
sprintf(t('Update %s failed. See error logs.'), $x)
|
||||
);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
use \Friendica\Core\System;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Database\DBStructure;
|
||||
|
||||
require_once('include/datetime.php');
|
||||
|
||||
|
@ -829,12 +830,12 @@ class dba {
|
|||
/**
|
||||
* @brief Build the array with the table relations
|
||||
*
|
||||
* The array is build from the database definitions in dbstructure.php
|
||||
* The array is build from the database definitions in DBStructure.php
|
||||
*
|
||||
* This process must only be started once, since the value is cached.
|
||||
*/
|
||||
private static function build_relation_data() {
|
||||
$definition = db_definition();
|
||||
$definition = DBStructure::definition();
|
||||
|
||||
foreach ($definition AS $table => $structure) {
|
||||
foreach ($structure['fields'] AS $field => $field_struct) {
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\System;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
|
||||
|
@ -708,7 +709,7 @@ function admin_page_summary(App $a)
|
|||
$warningtext = array();
|
||||
if (DBM::is_result($r)) {
|
||||
$showwarning = true;
|
||||
$warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php include/dbstructure.php toinnodb</tt> of your Friendica installation for an automatic conversion.<br />'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
|
||||
$warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php scripts/dbstructure.php toinnodb</tt> of your Friendica installation for an automatic conversion.<br />'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
|
||||
}
|
||||
// Check if github.com/friendica/master/VERSION is higher then
|
||||
// the local version of Friendica. Check is opt-in, source may be master or devel branch
|
||||
|
@ -721,12 +722,11 @@ function admin_page_summary(App $a)
|
|||
}
|
||||
|
||||
if (Config::get('system', 'dbupdate', DB_UPDATE_NOT_CHECKED) == DB_UPDATE_NOT_CHECKED) {
|
||||
require_once("include/dbstructure.php");
|
||||
update_structure(false, true);
|
||||
DBStructure::updateStructure(false, true);
|
||||
}
|
||||
if (Config::get('system', 'dbupdate') == DB_UPDATE_FAILED) {
|
||||
$showwarning = true;
|
||||
$warningtext[] = t('The database update failed. Please run "php include/dbstructure.php update" from the command line and have a look at the errors that might appear.');
|
||||
$warningtext[] = t('The database update failed. Please run "php scripts/dbstructure.php update" from the command line and have a look at the errors that might appear.');
|
||||
}
|
||||
|
||||
$last_worker_call = Config::get('system', 'last_poller_execution', false);
|
||||
|
@ -1385,8 +1385,7 @@ function admin_page_dbsync(App $a)
|
|||
}
|
||||
|
||||
if (($a->argc > 2) && (intval($a->argv[2]) || ($a->argv[2] === 'check'))) {
|
||||
require_once("include/dbstructure.php");
|
||||
$retval = update_structure(false, true);
|
||||
$retval = DBStructure::updateStructure(false, true);
|
||||
if (!$retval) {
|
||||
$o .= sprintf(t("Database structure update %s was successfully applied."), DB_UPDATE_VERSION) . "<br />";
|
||||
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\Object\Image;
|
||||
|
||||
$install_wizard_pass = 1;
|
||||
|
@ -535,9 +536,7 @@ function load_database_rem($v, $i) {
|
|||
}
|
||||
|
||||
function load_database() {
|
||||
|
||||
require_once("include/dbstructure.php");
|
||||
$errors = update_structure(false, true);
|
||||
$errors = DBStructure::updateStructure(false, true);
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
* @brief Does database updates from the command line
|
||||
*/
|
||||
|
||||
require_once 'include/dbstructure.php';
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBStructure;
|
||||
|
||||
$a = new App(dirname(__DIR__));
|
||||
|
||||
|
@ -20,10 +19,10 @@ unset($db_host, $db_user, $db_pass, $db_data);
|
|||
if ($_SERVER["argc"] == 2) {
|
||||
switch ($_SERVER["argv"][1]) {
|
||||
case "dryrun":
|
||||
update_structure(true, false);
|
||||
DBStructure::updateStructure(true, false);
|
||||
return;
|
||||
case "update":
|
||||
update_structure(true, true);
|
||||
DBStructure::updateStructure(true, true);
|
||||
|
||||
$build = Config::get('system','build');
|
||||
if (!x($build)) {
|
||||
|
@ -45,10 +44,10 @@ if ($_SERVER["argc"] == 2) {
|
|||
Config::set('system','build',DB_UPDATE_VERSION);
|
||||
return;
|
||||
case "dumpsql":
|
||||
print_structure(db_definition());
|
||||
DBStructure::printStructure(db_definition());
|
||||
return;
|
||||
case "toinnodb":
|
||||
convert_to_innodb();
|
||||
DBStructure::convertToInnoDB();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,12 +10,6 @@ use Friendica\Database\DBM;
|
|||
require_once "boot.php";
|
||||
require_once "include/text.php";
|
||||
|
||||
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
|
||||
|
||||
const DB_UPDATE_NOT_CHECKED = 0; // Database check wasn't executed before
|
||||
const DB_UPDATE_SUCCESSFUL = 1; // Database check was successful
|
||||
const DB_UPDATE_FAILED = 2; // Database check failed
|
||||
|
||||
/*
|
||||
* Converts all tables from MyISAM to InnoDB
|
||||
*/
|
|
@ -33,14 +33,14 @@ use Friendica\Object\Image;
|
|||
* The DB_UPDATE_VERSION will always be one greater than the last numbered script in this file.
|
||||
*
|
||||
* If you change the database schema, the following are required:
|
||||
* 1. Update the file include/dbstructure.php to match the new schema.
|
||||
* 1. Update the file src/Database/DBStructure.php to match the new schema.
|
||||
* 2. If there is a need for a post procession, update this file by adding a new function at the end with the number of the current DB_UPDATE_VERSION.
|
||||
* This function should perform some post procession steps but no database updates.
|
||||
* 3. Increment the DB_UPDATE_VERSION in boot.php *AND* the UPDATE_VERSION in this file to match it
|
||||
* 4. TEST the upgrade prior to checkin and filing a pull request.
|
||||
*
|
||||
* IMPORTANT!
|
||||
* NEVER do a database change anymore in the update functions! Only do this in the file include/dbstructure.php!
|
||||
* NEVER do a database change anymore in the update functions! Only do this in the file src/Database/DBStructure.php!
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1609,7 +1609,7 @@ ATTENTION!
|
|||
|
||||
All following update functions are ONLY for jobs that need to run AFTER the database changes are applied.
|
||||
|
||||
Database changes are ONLY applied in the file include/dbstructure.php.
|
||||
Database changes are ONLY applied in the file src/Database/DBStructure.php.
|
||||
*/
|
||||
|
||||
function update_1177() {
|
||||
|
|
Loading…
Reference in a new issue