X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FConsole%2FRelocate.php;h=a6fdd8bfbd1304a0ecff34e1656236fd04b6334e;hb=4e674d98eb1396f252988e3bde827e850b8a9239;hp=c1db6ef534c604f42f70c07c11522b67b48418ac;hpb=4cb5cadba86da3d168d8206103f763853c61e387;p=friendica.git diff --git a/src/Console/Relocate.php b/src/Console/Relocate.php index c1db6ef534..a6fdd8bfbd 100644 --- a/src/Console/Relocate.php +++ b/src/Console/Relocate.php @@ -1,6 +1,6 @@ ://'); } - $this->out(sprintf('Relocation started from %s to %s. Could take a while to complete.', $this->baseUrl->get(true), $this->getArgument(0))); + $this->out(sprintf('Relocation started from %s to %s. Could take a while to complete.', $this->baseUrl, $this->getArgument(0))); - $old_url = $this->baseUrl->get(true); + $old_url = $this->baseUrl; // Generate host names for relocation the addresses in the format user@address.tld $new_host = str_replace('http://', '@', Strings::normaliseLink($new_url)); $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); @@ -178,7 +179,6 @@ HELP; // update config $this->out('Updating config values'); $this->config->set('system', 'url', $new_url); - $this->baseUrl->saveByURL($new_url); $this->database->commit(); } catch (\Throwable $e) { @@ -189,15 +189,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;