]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Console/Maintenance.php
Merge pull request #6955 from tobiasd/20190331-vier
[friendica.git] / src / Core / Console / Maintenance.php
index cf0a468ff6fcf1b196ef80527cf664d2f8e369d7..0cb0da9c60e01596a4f457e72d443d599746d08e 100644 (file)
@@ -4,13 +4,10 @@ namespace Friendica\Core\Console;
 
 use Friendica\Core;
 
-require_once 'boot.php';
-require_once 'include/dba.php';
-
 /**
  * @brief Sets maintenance mode for this node
  *
- * @author Hypolite Petovan <mrpetovan@gmail.com>
+ * @author Hypolite Petovan <hypolite@mrpetovan.com>
  */
 class Maintenance extends \Asika\SimpleConsole\Console
 {
@@ -47,6 +44,8 @@ HELP;
 
        protected function doExecute()
        {
+               $a = \Friendica\BaseObject::getApp();
+
                if ($this->getOption('v')) {
                        $this->out('Class: ' . __CLASS__);
                        $this->out('Arguments: ' . var_export($this->args, true));
@@ -62,19 +61,10 @@ HELP;
                        throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
                }
 
-               require_once '.htconfig.php';
-               $result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
-               unset($db_host, $db_user, $db_pass, $db_data);
-
-               if (!$result) {
-                       throw new \RuntimeException('Unable to connect to database');
+               if ($a->getMode()->isInstall()) {
+                       throw new \RuntimeException('Database isn\'t ready or populated yet');
                }
 
-               Core\Config::load();
-
-               $lang = Core\L10n::getBrowserLanguage();
-               Core\L10n::loadTranslationTable($lang);
-
                $enabled = intval($this->getArgument(0));
 
                Core\Config::set('system', 'maintenance', $enabled);