Rework App modes

- Replace App mode constants with capability-based flags
- Add App->isInstallMode()
- Add file config fallback in (P)Config abstraction
- Removed logger disabling code
This commit is contained in:
Hypolite Petovan 2018-06-30 14:40:09 -04:00
parent d487c399dd
commit cd9b864045
12 changed files with 74 additions and 79 deletions

View file

@ -92,7 +92,7 @@ HELP;
throw new CommandArgsException('Too many arguments');
}
if ($a->mode === \Friendica\App::MODE_INSTALL) {
if (!($a->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
$this->out('Database isn\'t ready or populated yet, showing file config only');
}
@ -126,7 +126,7 @@ HELP;
if (count($this->args) == 0) {
Core\Config::load();
if (Core\Config::get('system', 'config_adapter') != 'preload' && $a->mode !== \Friendica\App::MODE_INSTALL) {
if (Core\Config::get('system', 'config_adapter') != 'preload' && $a->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE) {
$this->out('Warning: The JIT (Just In Time) Config adapter doesn\'t support loading the entire configuration, showing file config only');
}

View file

@ -56,7 +56,7 @@ HELP;
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
if ($a->mode == \Friendica\App::MODE_INSTALL) {
if ($a->isInstallMode()) {
throw new \RuntimeException('Database isn\'t ready or populated yet');
}

View file

@ -64,7 +64,7 @@ HELP;
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
if ($a->mode == \Friendica\App::MODE_INSTALL) {
if ($a->isInstallMode()) {
throw new \RuntimeException('Database isn\'t ready or populated yet');
}

View file

@ -64,7 +64,7 @@ HELP;
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
if ($a->mode == \Friendica\App::MODE_INSTALL) {
if ($a->isInstallMode()) {
throw new \RuntimeException('Database isn\'t ready or populated yet');
}

View file

@ -58,7 +58,7 @@ HELP;
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
if ($a->mode == \Friendica\App::MODE_INSTALL) {
if ($a->isInstallMode()) {
throw new \RuntimeException('Database isn\'t ready or populated yet');
}