Browse Source

Avoid undefined class variables

tags/3.5.4
Michael 1 year ago
parent
commit
225eea2ca6

+ 5
- 0
boot.php View File

@@ -510,6 +510,11 @@ function startup() {
510 510
  */
511 511
 function get_app() {
512 512
 	global $a;
513
+
514
+	if (empty($a)) {
515
+		$a = new App(dirname(__DIR__));
516
+	}
517
+
513 518
 	return $a;
514 519
 }
515 520
 

+ 1
- 1
include/auth_ejabberd.php View File

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

+ 1
- 1
include/cli_startup.php View File

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

+ 1
- 1
include/dbstructure.php View File

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

+ 3
- 1
include/poller.php View File

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

+ 1
- 1
include/shadowupdate.php View File

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

+ 3
- 1
index.php View File

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

+ 3
- 1
util/db_update.php View File

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

+ 4
- 1
util/maintenance.php View File

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

+ 3
- 1
util/typo.php View File

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

Loading…
Cancel
Save