Browse Source

Ensure BaseObject::setApp() whenever App is instantiated

tags/2018.05
Hypolite Petovan 1 year ago
parent
commit
354bec58c0
7 changed files with 16 additions and 9 deletions
  1. 2
    0
      boot.php
  2. 1
    3
      index.php
  3. 2
    0
      scripts/auth_ejabberd.php
  4. 1
    0
      scripts/dbstructure.php
  5. 2
    0
      scripts/worker.php
  6. 4
    3
      util/maintenance.php
  7. 4
    3
      util/typo.php

+ 2
- 0
boot.php View File

@@ -20,6 +20,7 @@
20 20
 require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
21 21
 
22 22
 use Friendica\App;
23
+use Friendica\BaseObject;
23 24
 use Friendica\Core\Addon;
24 25
 use Friendica\Core\Cache;
25 26
 use Friendica\Core\Config;
@@ -536,6 +537,7 @@ function get_app()
536 537
 
537 538
 	if (empty($a)) {
538 539
 		$a = new App(dirname(__DIR__));
540
+		BaseObject::setApp($a);
539 541
 	}
540 542
 
541 543
 	return $a;

+ 1
- 3
index.php View File

@@ -24,9 +24,7 @@ use Friendica\Module\Login;
24 24
 
25 25
 require_once 'boot.php';
26 26
 
27
-if (empty($a)) {
28
-	$a = new App(__DIR__);
29
-}
27
+$a = new App(__DIR__);
30 28
 BaseObject::setApp($a);
31 29
 
32 30
 // We assume that the index.php is called by a frontend process

+ 2
- 0
scripts/auth_ejabberd.php View File

@@ -33,6 +33,7 @@
33 33
  */
34 34
 
35 35
 use Friendica\App;
36
+use Friendica\BaseObject;
36 37
 use Friendica\Util\ExAuth;
37 38
 
38 39
 if (sizeof($_SERVER["argv"]) == 0) {
@@ -53,6 +54,7 @@ require_once "boot.php";
53 54
 require_once "include/dba.php";
54 55
 
55 56
 $a = new App(dirname(__DIR__));
57
+BaseObject::setApp($a);
56 58
 
57 59
 @include ".htconfig.php";
58 60
 dba::connect($db_host, $db_user, $db_pass, $db_data);

+ 1
- 0
scripts/dbstructure.php View File

@@ -13,6 +13,7 @@ require_once "boot.php";
13 13
 require_once "include/dba.php";
14 14
 
15 15
 $a = new App(dirname(__DIR__));
16
+BaseObject::setApp($a);
16 17
 
17 18
 @include ".htconfig.php";
18 19
 dba::connect($db_host, $db_user, $db_pass, $db_data);

+ 2
- 0
scripts/worker.php View File

@@ -6,6 +6,7 @@
6 6
  */
7 7
 
8 8
 use Friendica\App;
9
+use Friendica\BaseObject;
9 10
 use Friendica\Core\Addon;
10 11
 use Friendica\Core\Config;
11 12
 use Friendica\Core\Worker;
@@ -26,6 +27,7 @@ require_once "boot.php";
26 27
 require_once "include/dba.php";
27 28
 
28 29
 $a = new App(dirname(__DIR__));
30
+BaseObject::setApp($a);
29 31
 
30 32
 require_once ".htconfig.php";
31 33
 dba::connect($db_host, $db_user, $db_pass, $db_data);

+ 4
- 3
util/maintenance.php View File

@@ -2,16 +2,17 @@
2 2
 /**
3 3
  * @file util/maintenance.php
4 4
  */
5
+
5 6
 use Friendica\App;
7
+use Friendica\BaseObject;
6 8
 use Friendica\Core\Config;
7 9
 use Friendica\Core\L10n;
8 10
 
9 11
 require_once 'boot.php';
10 12
 require_once 'include/dba.php';
11 13
 
12
-if (empty($a)) {
13
-	$a = new App(dirname(__DIR__));
14
-}
14
+$a = new App(dirname(__DIR__));
15
+BaseObject::setApp($a);
15 16
 
16 17
 @include(".htconfig.php");
17 18
 

+ 4
- 3
util/typo.php View File

@@ -5,7 +5,9 @@
5 5
 // Run this from cmdline in basedir and quickly see if we've
6 6
 // got any parse errors in our application files.
7 7
 
8
+
8 9
 use Friendica\App;
10
+use Friendica\BaseObject;
9 11
 
10 12
 error_reporting(E_ERROR | E_WARNING | E_PARSE);
11 13
 ini_set('display_errors', '1');
@@ -13,9 +15,8 @@ ini_set('log_errors', '0');
13 15
 
14 16
 include 'boot.php';
15 17
 
16
-if (empty($a)) {
17
-	$a = new App(dirname(__DIR__));
18
-}
18
+$a = new App(dirname(__DIR__));
19
+BaseObject::setApp($a);
19 20
 
20 21
 if (x($a->config, 'php_path')) {
21 22
 	$phpath = $a->config['php_path'];

Loading…
Cancel
Save