<?php
/**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\DI;
use Friendica\Network\HTTPException;
use Friendica\Util\BasePath;
+use Friendica\Util\Profiler;
use Friendica\Util\Temporal;
+use Psr\Log\LoggerInterface;
class Install extends BaseModule
{
* @var Core\Installer The installer
*/
private $installer;
-
+
/** @var App */
protected $app;
/** @var App\Mode */
protected $mode;
- /** @var App\BaseURL */
- protected $baseUrl;
- public function __construct(App $app, App\Mode $mode, App\BaseURL $baseUrl, App\Arguments $args, Core\Installer $installer, L10n $l10n, array $parameters = [])
+ public function __construct(App $app, App\Mode $mode, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Core\Installer $installer, array $server, array $parameters = [])
{
- parent::__construct($l10n, $parameters);
+ parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->app = $app;
$this->mode = $mode;
- $this->baseUrl = $baseUrl;
$this->installer = $installer;
if (!$this->mode->isInstall()) {
$this->currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK;
}
- public function post()
+ protected function post(array $request = [])
{
$configCache = $this->app->getConfigCache();
return;
}
- $this->installer->installDatabase($configCache->get('system', 'basepath'));
+ $this->installer->installDatabase();
// install allowed themes to register theme hooks
// this is same as "Reload active theme" in /admin/themes
}
}
- public function content(): string
+ protected function content(array $request = []): string
{
$configCache = $this->app->getConfigCache();
if (count($this->installer->getChecks()) == 0) {
$txt = '<p style="font-size: 130%;">';
- $txt .= $this->t('Your Friendica site database has been installed.') . EOL;
+ $txt .= $this->t('Your Friendica site database has been installed.') . '<br />';
$db_return_text .= $txt;
}
* @return string The text for the next steps
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- private function whatNext()
+ private function whatNext(): string
{
$baseurl = $this->baseUrl->get();
return
* @param string $cat The category of the setting
* @param string $key The key of the setting
* @param null|string $default The default value
+ * @return void
*/
- private function checkSetting(Cache $configCache, array $post, $cat, $key, $default = null)
+ private function checkSetting(Cache $configCache, array $post, string $cat, string $key, ?string $default = null)
{
- $configCache->set($cat, $key,
- trim(($post[sprintf('%s-%s', $cat, $key)] ?? '') ?:
- ($default ?? $configCache->get($cat, $key))
- )
- );
+ $value = null;
+
+ if (isset($post[sprintf('%s-%s', $cat, $key)])) {
+ $value = trim($post[sprintf('%s-%s', $cat, $key)]);
+ }
+
+ if (isset($value)) {
+ $configCache->set($cat, $key, $value, Cache::SOURCE_ENV);
+ return;
+ }
+
+ if (isset($default)) {
+ $configCache->set($cat, $key, $default, Cache::SOURCE_ENV);
+ }
}
}