dbupdate now moved as well
This commit is contained in:
parent
659748d27c
commit
13f899542d
6 changed files with 28 additions and 14 deletions
2
boot.php
2
boot.php
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
18
src/Worker/DBUpdate.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue