use Friendica\Capabilities\ICanCreateResponses;
use Friendica\Core\Config\Factory\Config;
use Friendica\Core\Session\Capability\IHandleUserSessions;
+use Friendica\Database\Definition\DbaDefinition;
+use Friendica\Database\Definition\ViewDefinition;
use Friendica\Model\User;
use Friendica\Module\Maintenance;
use Friendica\Security\Authentication;
{
const PLATFORM = 'Friendica';
const CODENAME = 'Giant Rhubarb';
- const VERSION = '2022.12-dev';
+ const VERSION = '2023.03-dev';
// Allow themes to control internal parameters
// by changing App values in theme.php
* @param App\Arguments $args The Friendica Arguments of the call
* @param IManagePersonalConfigValues $pConfig Personal configuration
* @param IHandleUserSessions $session The (User)Session handler
+ * @param DbaDefinition $dbaDefinition
+ * @param ViewDefinition $viewDefinition
*/
- public function __construct(Database $database, IManageConfigValues $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, IManagePersonalConfigValues $pConfig, IHandleUserSessions $session)
+ public function __construct(Database $database, IManageConfigValues $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, IManagePersonalConfigValues $pConfig, IHandleUserSessions $session, DbaDefinition $dbaDefinition, ViewDefinition $viewDefinition)
{
- $this->database = $database;
- $this->config = $config;
- $this->mode = $mode;
- $this->baseURL = $baseURL;
- $this->profiler = $profiler;
- $this->logger = $logger;
- $this->l10n = $l10n;
- $this->args = $args;
- $this->pConfig = $pConfig;
- $this->session = $session;
+ $this->database = $database;
+ $this->config = $config;
+ $this->mode = $mode;
+ $this->baseURL = $baseURL;
+ $this->profiler = $profiler;
+ $this->logger = $logger;
+ $this->l10n = $l10n;
+ $this->args = $args;
+ $this->pConfig = $pConfig;
+ $this->session = $session;
- $this->load();
+ $this->load($dbaDefinition, $viewDefinition);
}
/**
* Load the whole app instance
*/
- public function load()
+ protected function load(DbaDefinition $dbaDefinition, ViewDefinition $viewDefinition)
{
set_time_limit(0);
Core\Hook::loadHooks();
$loader = (new Config())->createConfigFileLoader($this->getBasePath(), $_SERVER);
Core\Hook::callAll('load_config', $loader);
+
+ // Hooks are now working, reload the whole definitions with hook enabled
+ $dbaDefinition->load(true);
+ $viewDefinition->load(true);
}
$this->loadDefaultTimezone();
// ZRL
if (!empty($_GET['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
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == '') &&
- strstr(parse_url($_GET['zrl'], PHP_URL_PATH), '/profile/')) {
+ strpos(parse_url($_GET['zrl'], PHP_URL_PATH) ?? '', '/profile/') !== false) {
if ($this->session->get('visitor_home') != $_GET['zrl']) {
$this->session->set('my_url', $_GET['zrl']);
$this->session->set('authenticated', 0);