]> git.mxchange.org Git - friendica.git/blobdiff - src/Console/Maintenance.php
spelling: unable
[friendica.git] / src / Console / Maintenance.php
index 29ae120f7d88f4b9f050fc87798f840dbfefcdf6..076b89db828279fc8bc7d0b7c97370b5af777747 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -77,7 +77,7 @@ HELP;
                $this->config = $config;
        }
 
-       protected function doExecute()
+       protected function doExecute(): int
        {
                if ($this->getOption('v')) {
                        $this->out('Class: ' . __CLASS__);
@@ -100,16 +100,20 @@ HELP;
 
                $enabled = intval($this->getArgument(0));
 
-               $this->config->set('system', 'maintenance', $enabled);
+               $transactionConfig = $this->config->beginTransaction();
+
+               $transactionConfig->set('system', 'maintenance', $enabled);
 
                $reason = $this->getArgument(1);
 
                if ($enabled && $this->getArgument(1)) {
-                       $this->config->set('system', 'maintenance_reason', $this->getArgument(1));
+                       $transactionConfig->set('system', 'maintenance_reason', $this->getArgument(1));
                } else {
-                       $this->config->set('system', 'maintenance_reason', '');
+                       $transactionConfig->delete('system', 'maintenance_reason');
                }
 
+               $transactionConfig->commit();
+
                if ($enabled) {
                        $mode_str = "maintenance mode";
                } else {