Include DBA definitions from Hooks again

This commit is contained in:
Philipp 2022-12-16 21:59:32 +01:00
parent 2ae3ae0b8a
commit 1c789d487b
No known key found for this signature in database
GPG Key ID: 24A7501396EB5432
2 changed files with 23 additions and 14 deletions

View File

@ -27,6 +27,8 @@ use Friendica\App\BaseURL;
use Friendica\Capabilities\ICanCreateResponses; use Friendica\Capabilities\ICanCreateResponses;
use Friendica\Core\Config\Factory\Config; use Friendica\Core\Config\Factory\Config;
use Friendica\Core\Session\Capability\IHandleUserSessions; use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\Database\Definition\DbaDefinition;
use Friendica\Database\Definition\ViewDefinition;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Module\Maintenance; use Friendica\Module\Maintenance;
use Friendica\Security\Authentication; use Friendica\Security\Authentication;
@ -337,8 +339,10 @@ class App
* @param App\Arguments $args The Friendica Arguments of the call * @param App\Arguments $args The Friendica Arguments of the call
* @param IManagePersonalConfigValues $pConfig Personal configuration * @param IManagePersonalConfigValues $pConfig Personal configuration
* @param IHandleUserSessions $session The (User)Session handler * @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->database = $database;
$this->config = $config; $this->config = $config;
@ -351,13 +355,13 @@ class App
$this->pConfig = $pConfig; $this->pConfig = $pConfig;
$this->session = $session; $this->session = $session;
$this->load(); $this->load($dbaDefinition, $viewDefinition);
} }
/** /**
* Load the whole app instance * Load the whole app instance
*/ */
public function load() protected function load(DbaDefinition $dbaDefinition, ViewDefinition $viewDefinition)
{ {
set_time_limit(0); set_time_limit(0);
@ -386,6 +390,10 @@ class App
Core\Hook::loadHooks(); Core\Hook::loadHooks();
$loader = (new Config())->createConfigFileLoader($this->getBasePath(), $_SERVER); $loader = (new Config())->createConfigFileLoader($this->getBasePath(), $_SERVER);
Core\Hook::callAll('load_config', $loader); 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(); $this->loadDefaultTimezone();

View File

@ -249,7 +249,8 @@ class DBStructure
// Get the definition // Get the definition
if (is_null($definition)) { if (is_null($definition)) {
$definition = DI::dbaDefinition()->getAll(); // just for Update purpose, reload the DBA definition with addons to explicit get the whole definition
$definition = DI::dbaDefinition()->load(true)->getAll();
} }
// MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements