define('DFRN_PROTOCOL_VERSION', '2.23');
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.
*
* @}
*/
-/**
- * @name Update
- *
- * DB update return values
- * @{
- */
-define('UPDATE_SUCCESS', 0);
-define('UPDATE_FAILED', 1);
-/**
- * @}
- */
-
/**
* @name CP
*
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Core\Theme;
+use Friendica\Core\Update;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
}
}
- if (Config::get('system', 'dbupdate', DB_UPDATE_NOT_CHECKED) == DB_UPDATE_NOT_CHECKED) {
+ if (Config::get('system', 'dbupdate', DBStructure::UPDATE_NOT_CHECKED) == DBStructure::UPDATE_NOT_CHECKED) {
DBStructure::update(false, true);
}
- if (Config::get('system', 'dbupdate') == DB_UPDATE_FAILED) {
+ if (Config::get('system', 'dbupdate') == DBStructure::UPDATE_FAILED) {
$showwarning = true;
$warningtext[] = L10n::t('The database update failed. Please run "php bin/console.php dbstructure update" from the command line and have a look at the errors that might appear.');
}
if (function_exists($func)) {
$retval = $func();
- if ($retval === UPDATE_FAILED) {
+ if ($retval === Update::FAILED) {
$o .= L10n::t("Executing %s failed with error: %s", $func, $retval);
- } elseif ($retval === UPDATE_SUCCESS) {
+ } elseif ($retval === Update::SUCCESS) {
$o .= L10n::t('Update %s was successfully applied.', $func);
Config::set('database', $func, 'success');
} else {
class Update
{
+ const SUCCESS = 0;
+ const FAILED = 1;
+
/**
* Automatic database updates
*/
*/
class DBStructure
{
+ const UPDATE_NOT_CHECKED = 0; // Database check wasn't executed before
+ const UPDATE_SUCCESSFUL = 1; // Database check was successful
+ const UPDATE_FAILED = 2; // Database check failed
+
/**
* Database structure definition loaded from config/dbstructure.php
*
Config::set('system', 'maintenance_reason', '');
if ($errors) {
- Config::set('system', 'dbupdate', DB_UPDATE_FAILED);
+ Config::set('system', 'dbupdate', self::UPDATE_FAILED);
} else {
- Config::set('system', 'dbupdate', DB_UPDATE_SUCCESSFUL);
+ Config::set('system', 'dbupdate', self::UPDATE_SUCCESSFUL);
}
}
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
+use Friendica\Core\Update;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
// Update the central item storage with uid=0
Worker::add(PRIORITY_LOW, "threadupdate");
- return UPDATE_SUCCESS;
+ return Update::SUCCESS;
}
function update_1181() {
// Fill the new fields in the term table.
Worker::add(PRIORITY_LOW, "TagUpdate");
- return UPDATE_SUCCESS;
+ return Update::SUCCESS;
}
function update_1189() {
Config::delete('system','directory_submit_url');
}
- return UPDATE_SUCCESS;
+ return Update::SUCCESS;
}
function update_1191() {
Config::set('system', 'maintenance', 0);
- return UPDATE_SUCCESS;
+ return Update::SUCCESS;
}
function update_1203() {
// Logged in users are forcibly logged out
DBA::delete('session', ['1 = 1']);
- return UPDATE_SUCCESS;
+ return Update::SUCCESS;
}
function update_1245() {
$rino = Config::get('system', 'rino_encrypt');
if (!$rino) {
- return UPDATE_SUCCESS;
+ return Update::SUCCESS;
}
Config::set('system', 'rino_encrypt', 1);
- return UPDATE_SUCCESS;
+ return Update::SUCCESS;
}
function update_1247() {
SET `thread`.`author-id` = `item`.`author-id` WHERE `thread`.`author-id` = 0");
Config::set('system', 'maintenance', 0);
- return UPDATE_SUCCESS;
+ return Update::SUCCESS;
}
function update_1261() {
// This fixes the results of an issue in the develop branch of 2018-05.
DBA::update('contact', ['blocked' => false, 'pending' => false], ['uid' => 0, 'blocked' => true, 'pending' => true]);
- return UPDATE_SUCCESS;
+ return Update::SUCCESS;
}
function update_1278() {
Config::set('system', 'maintenance', 0);
- return UPDATE_SUCCESS;
+ return Update::SUCCESS;
}
function update_1288() {