]> git.mxchange.org Git - friendica.git/commitdiff
Include DBA definitions from Hooks again
authorPhilipp <admin@philipp.info>
Fri, 16 Dec 2022 20:59:32 +0000 (21:59 +0100)
committerPhilipp <admin@philipp.info>
Fri, 16 Dec 2022 20:59:32 +0000 (21:59 +0100)
src/App.php
src/Database/DBStructure.php

index 0d4e8880dd9d8373db64f8b0a60df3cd7325da83..e8385b7f29491b28dac1cd93e9db8663157829aa 100644 (file)
@@ -27,6 +27,8 @@ use Friendica\App\BaseURL;
 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;
@@ -337,27 +339,29 @@ class App
         * @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);
 
@@ -386,6 +390,10 @@ class App
                        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();
index 6e50c9fb2838bc6968df0f2a39555ac6ee9e5b22..cdb5d4ef987f5ea0620fdcae7056724fa656f0df 100644 (file)
@@ -249,7 +249,8 @@ class DBStructure
 
                // Get the 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