Add a App-Mode with defined constants

- Normal Mode = 0
- Install Mode = 1
- Maintenance Mode = 2

Moved Install-Mode check to class `App`

Replaced all maintenance and install checks with $a->mode checks
This commit is contained in:
Philipp Holzer 2018-04-27 21:07:04 +02:00
parent 6973aaefc2
commit d5b68cd146
5 changed files with 27 additions and 22 deletions

View file

@ -14,6 +14,10 @@ use Detection\MobileDetect;
use Exception;
define ('APP_MODE_NORMAL', 0);
define ('APP_MODE_INSTALL', 1);
define ('APP_MODE_MAINTENANCE', 2);
require_once 'boot.php';
require_once 'include/text.php';
@ -52,7 +56,7 @@ class App
public $argv;
public $argc;
public $module;
public $install_mode = false;
public $mode = APP_MODE_NORMAL;
public $pager;
public $strings;
public $basepath;
@ -289,6 +293,14 @@ class App
// Register template engines
$this->register_template_engine('Friendica\Render\FriendicaSmartyEngine');
/**
* Load the configuration file which contains our DB credentials.
* Ignore errors. If the file doesn't exist or is empty, we are running in
* installation mode. *
*/
$this->mode = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? APP_MODE_NORMAL : APP_MODE_INSTALL);
self::$a = $this;
}