namespace Friendica\Console;
-use Friendica\Core;
+use Friendica\App;
+use Friendica\Core\Config\IConfig;
/**
- * @brief Sets maintenance mode for this node
+ * Sets maintenance mode for this node
*
* @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
{
protected $helpOptions = ['h', 'help', '?'];
+ /**
+ * @var App\Mode
+ */
+ private $appMode;
+ /**
+ * @var IConfig
+ */
+ private $config;
+
protected function getHelp()
{
$help = <<<HELP
return $help;
}
- protected function doExecute()
+ public function __construct(App\Mode $appMode, IConfig $config, $argv = null)
{
- $a = \Friendica\BaseObject::getApp();
+ parent::__construct($argv);
+
+ $this->appMode = $appMode;
+ $this->config = $config;
+ }
+ protected function doExecute()
+ {
if ($this->getOption('v')) {
$this->out('Class: ' . __CLASS__);
$this->out('Arguments: ' . var_export($this->args, true));
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
- if ($a->getMode()->isInstall()) {
+ if ($this->appMode->isInstall()) {
throw new \RuntimeException('Database isn\'t ready or populated yet');
}
$enabled = intval($this->getArgument(0));
- Core\Config::set('system', 'maintenance', $enabled);
+ $this->config->set('system', 'maintenance', $enabled);
$reason = $this->getArgument(1);
if ($enabled && $this->getArgument(1)) {
- Core\Config::set('system', 'maintenance_reason', $this->getArgument(1));
+ $this->config->set('system', 'maintenance_reason', $this->getArgument(1));
} else {
- Core\Config::set('system', 'maintenance_reason', '');
+ $this->config->set('system', 'maintenance_reason', '');
}
if ($enabled) {