X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FConsole%2FRelocate.php;h=c63434cbb7e6e22b2176342937ecf6be30238f81;hb=af2a38c5b3724d140700316f3a0251e82692de38;hp=c0054d3963299502a8adcc29d11f3f32698114a1;hpb=47a3d8e6ce8461a457dee46d43d5ad14166f8013;p=friendica.git diff --git a/src/Console/Relocate.php b/src/Console/Relocate.php index c0054d3963..c63434cbb7 100644 --- a/src/Console/Relocate.php +++ b/src/Console/Relocate.php @@ -1,6 +1,6 @@ config = $config; } - protected function doExecute() + protected function doExecute(): int { if (count($this->args) == 0) { $this->out($this->getHelp()); @@ -101,9 +101,10 @@ HELP; $old_host = str_replace('http://', '@', Strings::normaliseLink($old_url)); $this->out('Entering maintenance mode'); - $this->config->set('system', 'maintenance', true); - $this->config->set('system', 'maintenance_reason', 'Relocating node to ' . $new_url); - + $this->config->beginTransaction() + ->set('system', 'maintenance', true) + ->set('system', 'maintenance_reason', 'Relocating node to ' . $new_url) + ->commit(); try { if (!$this->database->transaction()) { throw new \Exception('Unable to start a transaction, please retry later.'); @@ -131,9 +132,9 @@ HELP; $this->out('Updating event table fields'); $this->database->replaceInTableFields('event', ['uri'], $old_url, $new_url); - $this->out('Updating fcontact table fields'); - $this->database->replaceInTableFields('fcontact', ['url', 'photo', 'request', 'batch', 'poll', 'confirm', 'alias'], $old_url, $new_url); - $this->database->replaceInTableFields('fcontact', ['addr'], $old_host, $new_host); + $this->out('Updating diaspora-contact table fields'); + $this->database->replaceInTableFields('diaspora-contact', ['alias', 'photo', 'photo-medium', 'photo-small', 'batch', 'notify', 'poll', 'subscribe'], $old_url, $new_url); + $this->database->replaceInTableFields('diaspora-contact', ['addr'], $old_host, $new_host); $this->out('Updating fsuggest table fields'); $this->database->replaceInTableFields('fsuggest', ['url', 'request', 'photo'], $old_url, $new_url); @@ -189,15 +190,17 @@ HELP; return 1; } finally { $this->out('Leaving maintenance mode'); - $this->config->set('system', 'maintenance', false); - $this->config->set('system', 'maintenance_reason', ''); + $this->config->beginTransaction() + ->set('system', 'maintenance', false) + ->delete('system', 'maintenance_reason') + ->commit(); } // send relocate $this->out('Schedule relocation messages to remote Friendica and Diaspora hosts'); $users = $this->database->selectToArray('user', ['uid'], ['account_removed' => false, 'account_expired' => false]); foreach ($users as $user) { - Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $user['uid']); + Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $user['uid']); } return 0;