Avoid undefined class variables

This commit is contained in:
Michael 2017-10-11 14:52:08 +00:00
parent a29b7e7153
commit 225eea2ca6
10 changed files with 25 additions and 9 deletions

View file

@ -510,6 +510,11 @@ function startup() {
*/ */
function get_app() { function get_app() {
global $a; global $a;
if (empty($a)) {
$a = new App(dirname(__DIR__));
}
return $a; return $a;
} }

View file

@ -49,7 +49,7 @@ require_once("boot.php");
global $a; global $a;
if (is_null($a)) { if (empty($a)) {
$a = new App(dirname(__DIR__)); $a = new App(dirname(__DIR__));
} }

View file

@ -10,7 +10,7 @@ require_once('boot.php');
function cli_startup() { function cli_startup() {
global $a; global $a;
if (is_null($a)) { if (empty($a)) {
$a = new App(dirname(__DIR__)); $a = new App(dirname(__DIR__));
} }

View file

@ -1760,7 +1760,7 @@ function db_definition() {
function dbstructure_run(&$argv, &$argc) { function dbstructure_run(&$argv, &$argc) {
global $a; global $a;
if (is_null($a)) { if (empty($a)) {
$a = new App(dirname(__DIR__)); $a = new App(dirname(__DIR__));
} }

View file

@ -23,7 +23,9 @@ function poller_run($argv, $argc){
$poller_up_start = microtime(true); $poller_up_start = microtime(true);
if (empty($a)) {
$a = new App(dirname(__DIR__)); $a = new App(dirname(__DIR__));
}
require_once ".htconfig.php"; require_once ".htconfig.php";
require_once "include/dba.php"; require_once "include/dba.php";

View file

@ -9,7 +9,7 @@ require_once("include/threads.php");
function shadowupdate_run(&$argv, &$argc){ function shadowupdate_run(&$argv, &$argc){
global $a; global $a;
if (is_null($a)) { if (empty($a)) {
$a = new App(dirname(__DIR__)); $a = new App(dirname(__DIR__));
} }

View file

@ -20,7 +20,9 @@ use Friendica\Core\Config;
require_once 'boot.php'; require_once 'boot.php';
require_once 'object/BaseObject.php'; require_once 'object/BaseObject.php';
if (empty($a)) {
$a = new App(__DIR__); $a = new App(__DIR__);
}
BaseObject::set_app($a); BaseObject::set_app($a);
// We assume that the index.php is called by a frontend process // We assume that the index.php is called by a frontend process

View file

@ -11,7 +11,9 @@ use Friendica\App;
*/ */
require_once("boot.php"); require_once("boot.php");
if (empty($a)) {
$a = new App(dirname(__DIR__)); $a = new App(dirname(__DIR__));
}
@include(".htconfig.php"); @include(".htconfig.php");
$lang = get_browser_language(); $lang = get_browser_language();

View file

@ -5,7 +5,10 @@ use Friendica\Core\Config;
require_once("boot.php"); require_once("boot.php");
if (empty($a)) {
$a = new App(dirname(__DIR__)); $a = new App(dirname(__DIR__));
}
@include(".htconfig.php"); @include(".htconfig.php");
$lang = get_browser_language(); $lang = get_browser_language();

View file

@ -13,7 +13,9 @@ ini_set('log_errors', '0');
include 'boot.php'; include 'boot.php';
if (empty($a)) {
$a = new App(dirname(__DIR__)); $a = new App(dirname(__DIR__));
}
if (x($a->config, 'php_path')) { if (x($a->config, 'php_path')) {
$phpath = $a->config['php_path']; $phpath = $a->config['php_path'];