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
{
protected function doExecute()
{
- $a = get_app();
+ $a = \Friendica\BaseObject::getApp();
if ($this->getOption('v')) {
$this->out('Class: ' . __CLASS__);
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
- require_once 'config/.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);