Bugfix: Remove inactive/removed plugins from enabled_list

This commit is contained in:
djmaze 2021-03-08 12:22:49 +01:00
parent 6d0fa33022
commit dade7756f8
2 changed files with 19 additions and 21 deletions

View file

@ -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();
}

View file

@ -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');