mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-08 04:14:27 +02:00
Refactor StrategiesFileManager
This commit is contained in:
parent
b8b7d3cd15
commit
603f96b403
1 changed files with 17 additions and 22 deletions
|
@ -86,13 +86,10 @@ class StrategiesFileManager
|
||||||
/**
|
/**
|
||||||
* @deprecated 2025.02 Providing strategies via addons is deprecated and will be removed in 5 months.
|
* @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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private function getActiveAddonConfig(): array
|
||||||
* @deprecated 2025.02 Providing strategies via addons is deprecated and will be removed in 5 months.
|
|
||||||
*/
|
|
||||||
private function getActiveAddonConfig(string $configName): array
|
|
||||||
{
|
{
|
||||||
$addons = array_keys(array_filter($this->configuration->get('addons') ?? []));
|
$addons = array_keys(array_filter($this->configuration->get('addons') ?? []));
|
||||||
$returnConfig = [];
|
$returnConfig = [];
|
||||||
|
@ -100,7 +97,7 @@ class StrategiesFileManager
|
||||||
foreach ($addons as $addon) {
|
foreach ($addons as $addon) {
|
||||||
$addonName = Strings::sanitizeFilePathItem(trim($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)) {
|
if (!file_exists($configFile)) {
|
||||||
// Addon unmodified, skipping
|
// Addon unmodified, skipping
|
||||||
|
@ -113,7 +110,6 @@ class StrategiesFileManager
|
||||||
throw new AddonInvalidConfigFileException('Error loading config file ' . $configFile);
|
throw new AddonInvalidConfigFileException('Error loading config file ' . $configFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($configName === 'strategies') {
|
|
||||||
foreach ($config as $classname => $rule) {
|
foreach ($config as $classname => $rule) {
|
||||||
if ($classname === LoggerInterface::class) {
|
if ($classname === LoggerInterface::class) {
|
||||||
@trigger_error(sprintf(
|
@trigger_error(sprintf(
|
||||||
|
@ -130,7 +126,6 @@ class StrategiesFileManager
|
||||||
), \E_USER_DEPRECATED);
|
), \E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$returnConfig = array_merge_recursive($returnConfig, $config);
|
$returnConfig = array_merge_recursive($returnConfig, $config);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue