]> git.mxchange.org Git - friendica.git/commitdiff
Refactor StrategiesFileManager
authorArt4 <art4@wlabs.de>
Fri, 16 May 2025 08:28:24 +0000 (08:28 +0000)
committerArt4 <art4@wlabs.de>
Fri, 16 May 2025 08:28:24 +0000 (08:28 +0000)
src/Core/Hooks/Util/StrategiesFileManager.php

index f4fc5878c727353f29e148c344ce2f07718990ff..c56a13ee6ae01630c303882a7e2ca46621e3ed15 100644 (file)
@@ -86,13 +86,10 @@ class StrategiesFileManager
                /**
                 * @deprecated 2025.02 Providing strategies via addons is deprecated and will be removed in 5 months.
                 */
-               $this->config = array_merge_recursive($config, $this->getActiveAddonConfig(static::CONFIG_NAME));
+               $this->config = array_merge_recursive($config, $this->getActiveAddonConfig());
        }
 
-       /**
-        * @deprecated 2025.02 Providing strategies via addons is deprecated and will be removed in 5 months.
-        */
-       private function getActiveAddonConfig(string $configName): array
+       private function getActiveAddonConfig(): array
        {
                $addons       = array_keys(array_filter($this->configuration->get('addons') ?? []));
                $returnConfig = [];
@@ -100,7 +97,7 @@ class StrategiesFileManager
                foreach ($addons as $addon) {
                        $addonName = Strings::sanitizeFilePathItem(trim($addon));
 
-                       $configFile = $this->basePath . '/addon/' . $addonName . '/' . static::STATIC_DIR . '/' . $configName . '.config.php';
+                       $configFile = $this->basePath . '/addon/' . $addonName . '/' . static::STATIC_DIR . '/strategies.config.php';
 
                        if (!file_exists($configFile)) {
                                // Addon unmodified, skipping
@@ -113,22 +110,20 @@ class StrategiesFileManager
                                throw new AddonInvalidConfigFileException('Error loading config file ' . $configFile);
                        }
 
-                       if ($configName === 'strategies') {
-                               foreach ($config as $classname => $rule) {
-                                       if ($classname === LoggerInterface::class) {
-                                               @trigger_error(sprintf(
-                                                       'Providing a strategy for `%s` is deprecated since 2025.02 and will stop working in 5 months, please provide an implementation for `%s` via `dependency.config.php` and remove the `strategies.config.php` file in the `%s` addon.',
-                                                       $classname,
-                                                       LoggerFactory::class,
-                                                       $addonName,
-                                               ), \E_USER_DEPRECATED);
-                                       } else {
-                                               @trigger_error(sprintf(
-                                                       'Providing strategies for `%s` via addons is deprecated since 2025.02 and will stop working in 5 months, please stop using this and remove the `strategies.config.php` file in the `%s` addon.',
-                                                       $classname,
-                                                       $addonName,
-                                               ), \E_USER_DEPRECATED);
-                                       }
+                       foreach ($config as $classname => $rule) {
+                               if ($classname === LoggerInterface::class) {
+                                       @trigger_error(sprintf(
+                                               'Providing a strategy for `%s` is deprecated since 2025.02 and will stop working in 5 months, please provide an implementation for `%s` via `dependency.config.php` and remove the `strategies.config.php` file in the `%s` addon.',
+                                               $classname,
+                                               LoggerFactory::class,
+                                               $addonName,
+                                       ), \E_USER_DEPRECATED);
+                               } else {
+                                       @trigger_error(sprintf(
+                                               'Providing strategies for `%s` via addons is deprecated since 2025.02 and will stop working in 5 months, please stop using this and remove the `strategies.config.php` file in the `%s` addon.',
+                                               $classname,
+                                               $addonName,
+                                       ), \E_USER_DEPRECATED);
                                }
                        }