dbupdate now moved as well

This commit is contained in:
Michael 2017-11-18 07:31:33 +00:00
parent 659748d27c
commit 13f899542d
6 changed files with 28 additions and 14 deletions

View File

@ -630,7 +630,7 @@ function check_db($via_worker)
} }
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) {
update_db(get_app()); update_db(get_app());
} }
} }

View File

@ -1,13 +0,0 @@
<?php
use Friendica\Core\Config;
function dbupdate_run(&$argv, &$argc) {
global $a;
// We are deleting the latest dbupdate entry.
// This is done to avoid endless loops because the update was interupted.
Config::delete('database', 'dbupdate_'.DB_UPDATE_VERSION);
update_db($a);
}

View File

@ -1,4 +1,7 @@
<?php <?php
/**
* @file src/Worker/Cron.php
*/
namespace Friendica\Worker; namespace Friendica\Worker;
use Friendica\Core\Config; use Friendica\Core\Config;

View File

@ -1,4 +1,8 @@
<?php <?php
/**
* @file src/Worker/CronHooks.php
*/
namespace Friendica\Worker; namespace Friendica\Worker;
use Friendica\Core\Config; use Friendica\Core\Config;

View File

@ -4,6 +4,8 @@
* @brief The script is called from time to time to clean the database entries and remove orphaned data. * @brief The script is called from time to time to clean the database entries and remove orphaned data.
*/ */
namespace Friendica\Worker;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use dba; use dba;

18
src/Worker/DBUpdate.php Normal file
View File

@ -0,0 +1,18 @@
<?php
/**
* @file src/Worker/DBUpdate.php
* @brief This file is called when the database structure needs to be updated
*/
namespace Friendica\Worker;
use Friendica\Core\Config;
class DBUpdate {
public static function execute() {
// We are deleting the latest dbupdate entry.
// This is done to avoid endless loops because the update was interupted.
Config::delete('database', 'dbupdate_'.DB_UPDATE_VERSION);
update_db($a);
}
}