From 354bec58c080c7207d94a0fd5feb54e8b1056460 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 7 Mar 2018 12:34:47 -0500 Subject: [PATCH] Ensure BaseObject::setApp() whenever App is instantiated --- boot.php | 2 ++ index.php | 4 +--- scripts/auth_ejabberd.php | 2 ++ scripts/dbstructure.php | 1 + scripts/worker.php | 2 ++ util/maintenance.php | 7 ++++--- util/typo.php | 7 ++++--- 7 files changed, 16 insertions(+), 9 deletions(-) diff --git a/boot.php b/boot.php index a069dcafc9..9df5631881 100644 --- a/boot.php +++ b/boot.php @@ -20,6 +20,7 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; use Friendica\App; +use Friendica\BaseObject; use Friendica\Core\Addon; use Friendica\Core\Cache; use Friendica\Core\Config; @@ -536,6 +537,7 @@ function get_app() if (empty($a)) { $a = new App(dirname(__DIR__)); + BaseObject::setApp($a); } return $a; diff --git a/index.php b/index.php index 4fad08da83..fba16263ab 100644 --- a/index.php +++ b/index.php @@ -24,9 +24,7 @@ use Friendica\Module\Login; require_once 'boot.php'; -if (empty($a)) { - $a = new App(__DIR__); -} +$a = new App(__DIR__); BaseObject::setApp($a); // We assume that the index.php is called by a frontend process diff --git a/scripts/auth_ejabberd.php b/scripts/auth_ejabberd.php index 5c516f3987..3acd0590ec 100755 --- a/scripts/auth_ejabberd.php +++ b/scripts/auth_ejabberd.php @@ -33,6 +33,7 @@ */ use Friendica\App; +use Friendica\BaseObject; use Friendica\Util\ExAuth; if (sizeof($_SERVER["argv"]) == 0) { @@ -53,6 +54,7 @@ require_once "boot.php"; require_once "include/dba.php"; $a = new App(dirname(__DIR__)); +BaseObject::setApp($a); @include ".htconfig.php"; dba::connect($db_host, $db_user, $db_pass, $db_data); diff --git a/scripts/dbstructure.php b/scripts/dbstructure.php index 3787af2255..ff5b53c622 100755 --- a/scripts/dbstructure.php +++ b/scripts/dbstructure.php @@ -13,6 +13,7 @@ require_once "boot.php"; require_once "include/dba.php"; $a = new App(dirname(__DIR__)); +BaseObject::setApp($a); @include ".htconfig.php"; dba::connect($db_host, $db_user, $db_pass, $db_data); diff --git a/scripts/worker.php b/scripts/worker.php index a821fc1abe..1980a21b15 100755 --- a/scripts/worker.php +++ b/scripts/worker.php @@ -6,6 +6,7 @@ */ use Friendica\App; +use Friendica\BaseObject; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\Worker; @@ -26,6 +27,7 @@ require_once "boot.php"; require_once "include/dba.php"; $a = new App(dirname(__DIR__)); +BaseObject::setApp($a); require_once ".htconfig.php"; dba::connect($db_host, $db_user, $db_pass, $db_data); diff --git a/util/maintenance.php b/util/maintenance.php index a697e66d5a..f0d7777765 100644 --- a/util/maintenance.php +++ b/util/maintenance.php @@ -2,16 +2,17 @@ /** * @file util/maintenance.php */ + use Friendica\App; +use Friendica\BaseObject; use Friendica\Core\Config; use Friendica\Core\L10n; require_once 'boot.php'; require_once 'include/dba.php'; -if (empty($a)) { - $a = new App(dirname(__DIR__)); -} +$a = new App(dirname(__DIR__)); +BaseObject::setApp($a); @include(".htconfig.php"); diff --git a/util/typo.php b/util/typo.php index 313033f3e5..6a51880390 100755 --- a/util/typo.php +++ b/util/typo.php @@ -5,7 +5,9 @@ // Run this from cmdline in basedir and quickly see if we've // got any parse errors in our application files. + use Friendica\App; +use Friendica\BaseObject; error_reporting(E_ERROR | E_WARNING | E_PARSE); ini_set('display_errors', '1'); @@ -13,9 +15,8 @@ ini_set('log_errors', '0'); include 'boot.php'; -if (empty($a)) { - $a = new App(dirname(__DIR__)); -} +$a = new App(dirname(__DIR__)); +BaseObject::setApp($a); if (x($a->config, 'php_path')) { $phpath = $a->config['php_path']; -- 2.39.5