mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-28 18:41:34 +08:00
Bugfix: Remove inactive/removed plugins from enabled_list
This commit is contained in:
parent
6d0fa33022
commit
dade7756f8
2 changed files with 19 additions and 21 deletions
|
@ -835,8 +835,7 @@ trait Admin
|
|||
}
|
||||
}
|
||||
|
||||
$aNewEnabledPlugins = \array_unique($aNewEnabledPlugins);
|
||||
$oConfig->Set('plugins', 'enabled_list', \trim(\implode(',', $aNewEnabledPlugins), ' ,'));
|
||||
$oConfig->Set('plugins', 'enabled_list', \trim(\implode(',', \array_unique($aNewEnabledPlugins)), ' ,'));
|
||||
|
||||
return $oConfig->Save();
|
||||
}
|
||||
|
|
|
@ -80,28 +80,27 @@ class Manager
|
|||
$this->aAdditionalJson = array();
|
||||
$this->aProcessTemplate = array();
|
||||
|
||||
$this->bIsEnabled = (bool) $this->oActions->Config()->Get('plugins', 'enable', false);
|
||||
if ($this->bIsEnabled)
|
||||
{
|
||||
$sList = \strtolower($this->oActions->Config()->Get('plugins', 'enabled_list', ''));
|
||||
if (0 < \strlen($sList))
|
||||
{
|
||||
$aList = \explode(',', $sList);
|
||||
$aList = \array_map('trim', $aList);
|
||||
$oConfig = $this->oActions->Config();
|
||||
$this->bIsEnabled = (bool) $oConfig->Get('plugins', 'enable', false);
|
||||
if ($this->bIsEnabled) {
|
||||
$sList = $oConfig->Get('plugins', 'enabled_list', '');
|
||||
if (0 < \strlen($sList)) {
|
||||
$aList = \array_map('trim', \explode(',', $sList));
|
||||
foreach ($aList as $i => $sName) {
|
||||
$oPlugin = $this->CreatePluginByName($sName);
|
||||
if ($oPlugin) {
|
||||
$oPlugin->Init();
|
||||
|
||||
foreach ($aList as $sName)
|
||||
{
|
||||
if (0 < \strlen($sName))
|
||||
{
|
||||
$oPlugin = $this->CreatePluginByName($sName);
|
||||
if ($oPlugin)
|
||||
{
|
||||
$oPlugin->Init();
|
||||
|
||||
$this->aPlugins[] = $oPlugin;
|
||||
}
|
||||
$this->aPlugins[] = $oPlugin;
|
||||
} else {
|
||||
unset($aList[$i]);
|
||||
}
|
||||
}
|
||||
$aList = \implode(',', \array_unique($aList));
|
||||
if ($sList != $aList) {
|
||||
$oConfig->Set('plugins', 'enabled_list', $aList);
|
||||
$oConfig->Save();
|
||||
}
|
||||
}
|
||||
|
||||
$this->RunHook('api.bootstrap.plugins');
|
||||
|
|
Loading…
Reference in a new issue