mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-09 06:28:28 +03:00
centralize some code to \SnappyMail\Repository::getEnabledPackagesNames()
This commit is contained in:
parent
d52f2adb2b
commit
5fbca6fe48
3 changed files with 10 additions and 7 deletions
|
|
@ -704,9 +704,7 @@ class ActionsAdmin extends Actions
|
|||
|
||||
$oConfig = $this->Config();
|
||||
|
||||
$sEnabledPlugins = $oConfig->Get('plugins', 'enabled_list', '');
|
||||
$aEnabledPlugins = \explode(',', \strtolower($sEnabledPlugins));
|
||||
$aEnabledPlugins = \array_map('trim', $aEnabledPlugins);
|
||||
$aEnabledPlugins = \SnappyMail\Repository::getEnabledPackagesNames();
|
||||
|
||||
$aNewEnabledPlugins = array();
|
||||
if ($bEnable)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Manager
|
|||
if ($this->bIsEnabled) {
|
||||
$sList = $oConfig->Get('plugins', 'enabled_list', '');
|
||||
if (\strlen($sList)) {
|
||||
$aList = \array_map('trim', \explode(',', $sList));
|
||||
$aList = \SnappyMail\Repository::getEnabledPackagesNames();
|
||||
foreach ($aList as $i => $sName) {
|
||||
$oPlugin = $this->CreatePluginByName($sName);
|
||||
if ($oPlugin) {
|
||||
|
|
|
|||
|
|
@ -177,6 +177,13 @@ abstract class Repository
|
|||
&& \RainLoop\Api::Config()->Get('admin_panel', 'allow_update', false);
|
||||
}
|
||||
|
||||
public static function getEnabledPackagesNames() : array
|
||||
{
|
||||
return \array_map('trim',
|
||||
\explode(',', \strtolower(\RainLoop\Api::Config()->Get('plugins', 'enabled_list', '')))
|
||||
);
|
||||
}
|
||||
|
||||
public static function getPackagesList() : array
|
||||
{
|
||||
empty($_ENV['SNAPPYMAIL_INCLUDE_AS_API']) && \RainLoop\Api::Actions()->IsAdminLoggined();
|
||||
|
|
@ -185,9 +192,7 @@ abstract class Repository
|
|||
$sError = '';
|
||||
$aList = static::getRepositoryData($bReal, $sError);
|
||||
|
||||
$aEnabledPlugins = \array_map('trim',
|
||||
\explode(',', \strtolower(\RainLoop\Api::Config()->Get('plugins', 'enabled_list', '')))
|
||||
);
|
||||
$aEnabledPlugins = static::getEnabledPackagesNames();
|
||||
|
||||
$aInstalled = \RainLoop\Api::Actions()->Plugins()->InstalledPlugins();
|
||||
foreach ($aInstalled as $aItem) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue