]> git.mxchange.org Git - friendica.git/blobdiff - src/Console/Relocate.php
Merge pull request #12604 from nupplaphil/bug/marco_r
[friendica.git] / src / Console / Relocate.php
index a90802d81e22f46429c9d53931e66d7fda67d528..c63434cbb7e6e22b2176342937ecf6be30238f81 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -24,8 +24,8 @@ namespace Friendica\Console;
 use Asika\SimpleConsole\Console;
 use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Core\Worker;
+use Friendica\Protocol\Delivery;
 use Friendica\Util\Strings;
-use Friendica\Worker\Delivery;
 
 class Relocate extends Console
 {
@@ -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.');
@@ -189,8 +190,10 @@ 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