mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-09-02 08:09:19 +08:00
Add configs array handling methods to SystemConfigProviderInterface
- Add method to get config array - Add method to update config array - Add method to get default configs
This commit is contained in:
parent
aae9271c1b
commit
0e7b2c7539
2 changed files with 52 additions and 0 deletions
|
@ -166,6 +166,38 @@ class SystemConfigHandler extends LegacyHandler implements SystemConfigProviderI
|
|||
return self::HANDLER_KEY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getConfigs(): ?array
|
||||
{
|
||||
$this->init();
|
||||
|
||||
$config = $this->getLegacyConfig($this->legacyDir);
|
||||
|
||||
$this->close();
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getConfigDefaults(): ?array
|
||||
{
|
||||
$this->init();
|
||||
|
||||
try {
|
||||
$defaults = get_sugar_config_defaults();
|
||||
} catch (Exception $exception) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->close();
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get system config
|
||||
* @param array $config
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
namespace App\SystemConfig\Service;
|
||||
|
||||
use App\Engine\Model\Feedback;
|
||||
use App\SystemConfig\Entity\SystemConfig;
|
||||
|
||||
interface SystemConfigProviderInterface
|
||||
|
@ -45,4 +46,23 @@ interface SystemConfigProviderInterface
|
|||
* @return SystemConfig|null
|
||||
*/
|
||||
public function getSystemConfig(string $configKey): ?SystemConfig;
|
||||
|
||||
/**
|
||||
* Get legacy config array
|
||||
* @return array|null
|
||||
*/
|
||||
public function getConfigs(): ?array;
|
||||
|
||||
/**
|
||||
* Get legacy config defaults
|
||||
* @return array|null
|
||||
*/
|
||||
public function getConfigDefaults(): ?array;
|
||||
|
||||
/**
|
||||
* Get system config
|
||||
* @param array $config
|
||||
* @return Feedback
|
||||
*/
|
||||
public function updateSystemConfig(array $config): Feedback;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue