mirror of
https://github.com/friendica/friendica
synced 2025-04-24 03:10:11 +00:00
Introduce DICE
- Adding dice library - Adding dependency config - Removing Factories - Refactoring App\Mode constructor - Refactoring App\Router constructor - Refactoring BasePath for DI usage - Refactoring ConfigFileLoader constructor - Refactoring Profiler constructor - Adjust entrypoints (index, console, worker, ..) - Adding functional test for DI - Fix tests because of refactorings
This commit is contained in:
parent
5887b9c499
commit
55999730e0
28 changed files with 563 additions and 308 deletions
|
@ -3,7 +3,6 @@
|
|||
namespace Friendica\Util;
|
||||
|
||||
use Exception;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
|
||||
|
@ -52,10 +51,6 @@ class ConfigFileLoader
|
|||
*/
|
||||
const SAMPLE_END = '-sample';
|
||||
|
||||
/**
|
||||
* @var App\Mode
|
||||
*/
|
||||
private $appMode;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -69,12 +64,11 @@ class ConfigFileLoader
|
|||
*/
|
||||
private $staticDir;
|
||||
|
||||
public function __construct($baseDir, App\Mode $mode)
|
||||
public function __construct(string $basePath)
|
||||
{
|
||||
$this->baseDir = $baseDir;
|
||||
$this->configDir = $baseDir . DIRECTORY_SEPARATOR . self::CONFIG_DIR;
|
||||
$this->staticDir = $baseDir . DIRECTORY_SEPARATOR . self::STATIC_DIR;
|
||||
$this->appMode = $mode;
|
||||
$this->baseDir = $basePath;
|
||||
$this->configDir = $this->baseDir . DIRECTORY_SEPARATOR . self::CONFIG_DIR;
|
||||
$this->staticDir = $this->baseDir . DIRECTORY_SEPARATOR . self::STATIC_DIR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,7 +96,7 @@ class ConfigFileLoader
|
|||
$this->loadCoreConfig($config);
|
||||
|
||||
// In case of install mode, add the found basepath (because there isn't a basepath set yet
|
||||
if (!$raw && ($this->appMode->isInstall() || empty($config->get('system', 'basepath')))) {
|
||||
if (!$raw && empty($config->get('system', 'basepath'))) {
|
||||
// Setting at least the basepath we know
|
||||
$config->set('system', 'basepath', $this->baseDir);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue