mirror of
https://github.com/friendica/friendica
synced 2025-01-31 02:59:46 +00:00
Revert "Inject Mode into App::runFrontend() via parameter"
This reverts commit 52c6f93c9a
.
This commit is contained in:
parent
5a40fdd7e1
commit
ed184ab520
1 changed files with 10 additions and 12 deletions
22
src/App.php
22
src/App.php
|
@ -171,7 +171,6 @@ class App
|
||||||
$this->registerTemplateEngine();
|
$this->registerTemplateEngine();
|
||||||
|
|
||||||
$this->runFrontend(
|
$this->runFrontend(
|
||||||
$this->mode,
|
|
||||||
$this->container->create(IManagePersonalConfigValues::class),
|
$this->container->create(IManagePersonalConfigValues::class),
|
||||||
$this->container->create(Page::class),
|
$this->container->create(Page::class),
|
||||||
$this->container->create(Nav::class),
|
$this->container->create(Nav::class),
|
||||||
|
@ -374,7 +373,6 @@ class App
|
||||||
* @throws \ImagickException
|
* @throws \ImagickException
|
||||||
*/
|
*/
|
||||||
private function runFrontend(
|
private function runFrontend(
|
||||||
Mode $mode,
|
|
||||||
IManagePersonalConfigValues $pconfig,
|
IManagePersonalConfigValues $pconfig,
|
||||||
Page $page,
|
Page $page,
|
||||||
Nav $nav,
|
Nav $nav,
|
||||||
|
@ -382,7 +380,7 @@ class App
|
||||||
float $start_time,
|
float $start_time,
|
||||||
ServerRequestInterface $request
|
ServerRequestInterface $request
|
||||||
) {
|
) {
|
||||||
$mode->setExecutor(Mode::INDEX);
|
$this->mode->setExecutor(Mode::INDEX);
|
||||||
|
|
||||||
$httpInput = new HTTPInputData($request->getServerParams());
|
$httpInput = new HTTPInputData($request->getServerParams());
|
||||||
$serverVars = $request->getServerParams();
|
$serverVars = $request->getServerParams();
|
||||||
|
@ -401,11 +399,11 @@ class App
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Missing DB connection: ERROR
|
// Missing DB connection: ERROR
|
||||||
if ($mode->has(Mode::LOCALCONFIGPRESENT) && !$mode->has(Mode::DBAVAILABLE)) {
|
if ($this->mode->has(Mode::LOCALCONFIGPRESENT) && !$this->mode->has(Mode::DBAVAILABLE)) {
|
||||||
throw new HTTPException\InternalServerErrorException($this->l10n->t('Apologies but the website is unavailable at the moment.'));
|
throw new HTTPException\InternalServerErrorException($this->l10n->t('Apologies but the website is unavailable at the moment.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$mode->isInstall()) {
|
if (!$this->mode->isInstall()) {
|
||||||
// Force SSL redirection
|
// Force SSL redirection
|
||||||
if ($this->config->get('system', 'force_ssl') &&
|
if ($this->config->get('system', 'force_ssl') &&
|
||||||
(empty($serverVars['HTTPS']) || $serverVars['HTTPS'] === 'off') &&
|
(empty($serverVars['HTTPS']) || $serverVars['HTTPS'] === 'off') &&
|
||||||
|
@ -419,7 +417,7 @@ class App
|
||||||
|
|
||||||
DID::routeRequest($this->args->getCommand(), $serverVars);
|
DID::routeRequest($this->args->getCommand(), $serverVars);
|
||||||
|
|
||||||
if ($mode->isNormal() && !$mode->isBackend()) {
|
if ($this->mode->isNormal() && !$this->mode->isBackend()) {
|
||||||
$requester = HTTPSignature::getSigner('', $serverVars);
|
$requester = HTTPSignature::getSigner('', $serverVars);
|
||||||
if (!empty($requester)) {
|
if (!empty($requester)) {
|
||||||
OpenWebAuth::addVisitorCookieForHandle($requester);
|
OpenWebAuth::addVisitorCookieForHandle($requester);
|
||||||
|
@ -427,7 +425,7 @@ class App
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZRL
|
// ZRL
|
||||||
if (!empty($queryVars['zrl']) && $mode->isNormal() && !$mode->isBackend() && !$this->session->getLocalUserId()) {
|
if (!empty($queryVars['zrl']) && $this->mode->isNormal() && !$this->mode->isBackend() && !$this->session->getLocalUserId()) {
|
||||||
// Only continue when the given profile link seems valid.
|
// Only continue when the given profile link seems valid.
|
||||||
// Valid profile links contain a path with "/profile/" and no query parameters
|
// Valid profile links contain a path with "/profile/" and no query parameters
|
||||||
if ((parse_url($queryVars['zrl'], PHP_URL_QUERY) == '') &&
|
if ((parse_url($queryVars['zrl'], PHP_URL_QUERY) == '') &&
|
||||||
|
@ -442,12 +440,12 @@ class App
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($queryVars['owt']) && $mode->isNormal()) {
|
if (!empty($queryVars['owt']) && $this->mode->isNormal()) {
|
||||||
$token = $queryVars['owt'];
|
$token = $queryVars['owt'];
|
||||||
OpenWebAuth::init($token);
|
OpenWebAuth::init($token);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$mode->isBackend()) {
|
if (!$this->mode->isBackend()) {
|
||||||
$this->auth->withSession();
|
$this->auth->withSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,7 +461,7 @@ class App
|
||||||
|
|
||||||
// in install mode, any url loads install module
|
// in install mode, any url loads install module
|
||||||
// but we need "view" module for stylesheet
|
// but we need "view" module for stylesheet
|
||||||
if ($mode->isInstall() && $moduleName !== 'install') {
|
if ($this->mode->isInstall() && $moduleName !== 'install') {
|
||||||
$this->baseURL->redirect('install');
|
$this->baseURL->redirect('install');
|
||||||
} else {
|
} else {
|
||||||
Core\Update::check($this->appHelper->getBasePath(), false);
|
Core\Update::check($this->appHelper->getBasePath(), false);
|
||||||
|
@ -513,7 +511,7 @@ class App
|
||||||
$page['page_title'] = $moduleName;
|
$page['page_title'] = $moduleName;
|
||||||
|
|
||||||
// The "view" module is required to show the theme CSS
|
// The "view" module is required to show the theme CSS
|
||||||
if (!$mode->isInstall() && !$mode->has(Mode::MAINTENANCEDISABLED) && $moduleName !== 'view') {
|
if (!$this->mode->isInstall() && !$this->mode->has(Mode::MAINTENANCEDISABLED) && $moduleName !== 'view') {
|
||||||
$module = $this->createModuleInstance(Maintenance::class);
|
$module = $this->createModuleInstance(Maintenance::class);
|
||||||
} else {
|
} else {
|
||||||
// determine the module class and save it to the module instance
|
// determine the module class and save it to the module instance
|
||||||
|
@ -535,7 +533,7 @@ class App
|
||||||
|
|
||||||
// Wrapping HTML responses in the theme template
|
// Wrapping HTML responses in the theme template
|
||||||
if ($response->getHeaderLine(ICanCreateResponses::X_HEADER) === ICanCreateResponses::TYPE_HTML) {
|
if ($response->getHeaderLine(ICanCreateResponses::X_HEADER) === ICanCreateResponses::TYPE_HTML) {
|
||||||
$response = $page->run($this->appHelper, $this->session, $this->baseURL, $this->args, $mode, $response, $this->l10n, $this->profiler, $this->config, $pconfig, $nav, $this->session->getLocalUserId());
|
$response = $page->run($this->appHelper, $this->session, $this->baseURL, $this->args, $this->mode, $response, $this->l10n, $this->profiler, $this->config, $pconfig, $nav, $this->session->getLocalUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->debug('Request processed sucessfully', ['response' => $response->getStatusCode(), 'address' => $serverVars['REMOTE_ADDR'] ?? '', 'request' => $requeststring, 'referer' => $serverVars['HTTP_REFERER'] ?? '', 'user-agent' => $serverVars['HTTP_USER_AGENT'] ?? '', 'duration' => number_format(microtime(true) - $request_start, 3)]);
|
$this->logger->debug('Request processed sucessfully', ['response' => $response->getStatusCode(), 'address' => $serverVars['REMOTE_ADDR'] ?? '', 'request' => $requeststring, 'referer' => $serverVars['HTTP_REFERER'] ?? '', 'user-agent' => $serverVars['HTTP_USER_AGENT'] ?? '', 'duration' => number_format(microtime(true) - $request_start, 3)]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue