mirror of
https://github.com/friendica/friendica
synced 2025-05-19 14:24:15 +02:00
Move AppMode
This commit is contained in:
parent
d03dedee63
commit
1a2527cdba
7 changed files with 49 additions and 31 deletions
33
src/App.php
33
src/App.php
|
@ -165,6 +165,16 @@ class App
|
|||
return $this->profiler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Mode of the Application
|
||||
*
|
||||
* @return App\Mode The Application Mode
|
||||
*/
|
||||
public function getMode()
|
||||
{
|
||||
return $this->mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a stylesheet file path to be included in the <head> tag of every page.
|
||||
* Inclusion is done in App->initHead().
|
||||
|
@ -208,19 +218,21 @@ class App
|
|||
*
|
||||
* @param string $basePath The basedir of the app
|
||||
* @param Configuration $config The Configuration
|
||||
* @param App\Mode $mode The mode of this Friendica app
|
||||
* @param LoggerInterface $logger The current app logger
|
||||
* @param Profiler $profiler The profiler of this application
|
||||
* @param bool $isBackend Whether it is used for backend or frontend (Default true=backend)
|
||||
*
|
||||
* @throws Exception if the Basepath is not usable
|
||||
*/
|
||||
public function __construct($basePath, Configuration $config, LoggerInterface $logger, Profiler $profiler, $isBackend = true)
|
||||
public function __construct($basePath, Configuration $config, App\Mode $mode, LoggerInterface $logger, Profiler $profiler, $isBackend = true)
|
||||
{
|
||||
BaseObject::setApp($this);
|
||||
|
||||
$this->logger = $logger;
|
||||
$this->config = $config;
|
||||
$this->profiler = $profiler;
|
||||
$this->mode = $mode;
|
||||
$cfgBasePath = $this->config->get('system', 'basepath');
|
||||
$this->basePath = !empty($cfgBasePath) ? $cfgBasePath : $basePath;
|
||||
|
||||
|
@ -234,8 +246,6 @@ class App
|
|||
|
||||
$this->profiler->reset();
|
||||
|
||||
$this->mode = new App\Mode($this->basePath);
|
||||
|
||||
$this->reload();
|
||||
|
||||
set_time_limit(0);
|
||||
|
@ -335,22 +345,6 @@ class App
|
|||
Core\Renderer::registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Mode of the Application
|
||||
*
|
||||
* @return App\Mode The Application Mode
|
||||
*
|
||||
* @throws InternalServerErrorException when the mode isn't created
|
||||
*/
|
||||
public function getMode()
|
||||
{
|
||||
if (empty($this->mode)) {
|
||||
throw new InternalServerErrorException('Mode of the Application is not defined');
|
||||
}
|
||||
|
||||
return $this->mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads the whole app instance
|
||||
*/
|
||||
|
@ -369,6 +363,7 @@ class App
|
|||
$this->config->get('rendertime', 'callstack', false));
|
||||
|
||||
Core\Hook::loadHooks();
|
||||
$loader = new ConfigCacheLoader($this->basePath, $this->mode);
|
||||
Core\Hook::callAll('load_config', $loader);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue