mirror of
https://github.com/friendica/friendica
synced 2025-04-28 11:04:22 +02:00
Adding force to update routine
- Introduced Cache::NEVER Lock (never expiring lock) - Force flag for dbstructure update - Moving the business logic to central place in Update class
This commit is contained in:
parent
f2ec963b95
commit
270e817954
9 changed files with 141 additions and 104 deletions
|
@ -25,7 +25,7 @@ class DatabaseStructure extends \Asika\SimpleConsole\Console
|
|||
$help = <<<HELP
|
||||
console dbstructure - Performs database updates
|
||||
Usage
|
||||
bin/console dbstructure <command> [-h|--help|-?] [-v]
|
||||
bin/console dbstructure <command> [-h|--help|-?] |-f|--force] [-v]
|
||||
|
||||
Commands
|
||||
dryrun Show database update schema queries without running them
|
||||
|
@ -36,14 +36,13 @@ Commands
|
|||
Options
|
||||
-h|--help|-? Show help information
|
||||
-v Show more debug information.
|
||||
-f|--force Force the command in case of "update" (Ignore failed updates/running updates)
|
||||
HELP;
|
||||
return $help;
|
||||
}
|
||||
|
||||
protected function doExecute()
|
||||
{
|
||||
$a = get_app();
|
||||
|
||||
if ($this->getOption('v')) {
|
||||
$this->out('Class: ' . __CLASS__);
|
||||
$this->out('Arguments: ' . var_export($this->args, true));
|
||||
|
@ -70,34 +69,8 @@ HELP;
|
|||
$output = DBStructure::update(true, false);
|
||||
break;
|
||||
case "update":
|
||||
$build = Core\Config::get('system', 'build');
|
||||
if (empty($build)) {
|
||||
Core\Config::set('system', 'build', DB_UPDATE_VERSION);
|
||||
$build = DB_UPDATE_VERSION;
|
||||
}
|
||||
|
||||
$stored = intval($build);
|
||||
$current = intval(DB_UPDATE_VERSION);
|
||||
|
||||
// run the pre_update_nnnn functions in update.php
|
||||
for ($x = $stored; $x < $current; $x ++) {
|
||||
$r = Update::runUpdateFunction($x, 'pre_update');
|
||||
if (!$r) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$output = DBStructure::update(true, true);
|
||||
|
||||
// run the update_nnnn functions in update.php
|
||||
for ($x = $stored; $x < $current; $x ++) {
|
||||
$r = Update::runUpdateFunction($x, 'update');
|
||||
if (!$r) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Core\Config::set('system', 'build', DB_UPDATE_VERSION);
|
||||
$force = $this->getOption(['f', 'force'], false);
|
||||
$output = Update::run($force, true, false);
|
||||
break;
|
||||
case "dumpsql":
|
||||
ob_start();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue