diff --git a/boot.php b/boot.php index 5b82c8b8f2..899a6bd119 100644 --- a/boot.php +++ b/boot.php @@ -510,6 +510,11 @@ function startup() { */ function get_app() { global $a; + + if (empty($a)) { + $a = new App(dirname(__DIR__)); + } + return $a; } diff --git a/include/auth_ejabberd.php b/include/auth_ejabberd.php index 3918a45e15..14f5dcfe0c 100755 --- a/include/auth_ejabberd.php +++ b/include/auth_ejabberd.php @@ -49,7 +49,7 @@ require_once("boot.php"); global $a; -if (is_null($a)) { +if (empty($a)) { $a = new App(dirname(__DIR__)); } diff --git a/include/cli_startup.php b/include/cli_startup.php index 41d7c18954..645e5eddd8 100644 --- a/include/cli_startup.php +++ b/include/cli_startup.php @@ -10,7 +10,7 @@ require_once('boot.php'); function cli_startup() { global $a; - if (is_null($a)) { + if (empty($a)) { $a = new App(dirname(__DIR__)); } diff --git a/include/dbstructure.php b/include/dbstructure.php index 8ab96b700c..b8cf8e57ac 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -1760,7 +1760,7 @@ function db_definition() { function dbstructure_run(&$argv, &$argc) { global $a; - if (is_null($a)) { + if (empty($a)) { $a = new App(dirname(__DIR__)); } diff --git a/include/poller.php b/include/poller.php index 9868120ec8..b8f0d7189f 100644 --- a/include/poller.php +++ b/include/poller.php @@ -23,7 +23,9 @@ function poller_run($argv, $argc){ $poller_up_start = microtime(true); - $a = new App(dirname(__DIR__)); + if (empty($a)) { + $a = new App(dirname(__DIR__)); + } require_once ".htconfig.php"; require_once "include/dba.php"; diff --git a/include/shadowupdate.php b/include/shadowupdate.php index a2b44b3512..c41b231221 100644 --- a/include/shadowupdate.php +++ b/include/shadowupdate.php @@ -9,7 +9,7 @@ require_once("include/threads.php"); function shadowupdate_run(&$argv, &$argc){ global $a; - if (is_null($a)) { + if (empty($a)) { $a = new App(dirname(__DIR__)); } diff --git a/index.php b/index.php index 90045868e7..c94675a59a 100644 --- a/index.php +++ b/index.php @@ -20,7 +20,9 @@ use Friendica\Core\Config; require_once 'boot.php'; require_once 'object/BaseObject.php'; -$a = new App(__DIR__); +if (empty($a)) { + $a = new App(__DIR__); +} BaseObject::set_app($a); // We assume that the index.php is called by a frontend process diff --git a/util/db_update.php b/util/db_update.php index 885a156caa..d9bb0abf2e 100644 --- a/util/db_update.php +++ b/util/db_update.php @@ -11,7 +11,9 @@ use Friendica\App; */ require_once("boot.php"); -$a = new App(dirname(__DIR__)); +if (empty($a)) { + $a = new App(dirname(__DIR__)); +} @include(".htconfig.php"); $lang = get_browser_language(); diff --git a/util/maintenance.php b/util/maintenance.php index 50540ecc28..39c2acb0e1 100644 --- a/util/maintenance.php +++ b/util/maintenance.php @@ -5,7 +5,10 @@ use Friendica\Core\Config; require_once("boot.php"); -$a = new App(dirname(__DIR__)); +if (empty($a)) { + $a = new App(dirname(__DIR__)); +} + @include(".htconfig.php"); $lang = get_browser_language(); diff --git a/util/typo.php b/util/typo.php index d837bcefc9..313033f3e5 100755 --- a/util/typo.php +++ b/util/typo.php @@ -13,7 +13,9 @@ ini_set('log_errors', '0'); include 'boot.php'; -$a = new App(dirname(__DIR__)); +if (empty($a)) { + $a = new App(dirname(__DIR__)); +} if (x($a->config, 'php_path')) { $phpath = $a->config['php_path'];