mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +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();
|
$oConfig = $this->Config();
|
||||||
|
|
||||||
$sEnabledPlugins = $oConfig->Get('plugins', 'enabled_list', '');
|
$aEnabledPlugins = \SnappyMail\Repository::getEnabledPackagesNames();
|
||||||
$aEnabledPlugins = \explode(',', \strtolower($sEnabledPlugins));
|
|
||||||
$aEnabledPlugins = \array_map('trim', $aEnabledPlugins);
|
|
||||||
|
|
||||||
$aNewEnabledPlugins = array();
|
$aNewEnabledPlugins = array();
|
||||||
if ($bEnable)
|
if ($bEnable)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class Manager
|
||||||
if ($this->bIsEnabled) {
|
if ($this->bIsEnabled) {
|
||||||
$sList = $oConfig->Get('plugins', 'enabled_list', '');
|
$sList = $oConfig->Get('plugins', 'enabled_list', '');
|
||||||
if (\strlen($sList)) {
|
if (\strlen($sList)) {
|
||||||
$aList = \array_map('trim', \explode(',', $sList));
|
$aList = \SnappyMail\Repository::getEnabledPackagesNames();
|
||||||
foreach ($aList as $i => $sName) {
|
foreach ($aList as $i => $sName) {
|
||||||
$oPlugin = $this->CreatePluginByName($sName);
|
$oPlugin = $this->CreatePluginByName($sName);
|
||||||
if ($oPlugin) {
|
if ($oPlugin) {
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,13 @@ abstract class Repository
|
||||||
&& \RainLoop\Api::Config()->Get('admin_panel', 'allow_update', false);
|
&& \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
|
public static function getPackagesList() : array
|
||||||
{
|
{
|
||||||
empty($_ENV['SNAPPYMAIL_INCLUDE_AS_API']) && \RainLoop\Api::Actions()->IsAdminLoggined();
|
empty($_ENV['SNAPPYMAIL_INCLUDE_AS_API']) && \RainLoop\Api::Actions()->IsAdminLoggined();
|
||||||
|
|
@ -185,9 +192,7 @@ abstract class Repository
|
||||||
$sError = '';
|
$sError = '';
|
||||||
$aList = static::getRepositoryData($bReal, $sError);
|
$aList = static::getRepositoryData($bReal, $sError);
|
||||||
|
|
||||||
$aEnabledPlugins = \array_map('trim',
|
$aEnabledPlugins = static::getEnabledPackagesNames();
|
||||||
\explode(',', \strtolower(\RainLoop\Api::Config()->Get('plugins', 'enabled_list', '')))
|
|
||||||
);
|
|
||||||
|
|
||||||
$aInstalled = \RainLoop\Api::Actions()->Plugins()->InstalledPlugins();
|
$aInstalled = \RainLoop\Api::Actions()->Plugins()->InstalledPlugins();
|
||||||
foreach ($aInstalled as $aItem) {
|
foreach ($aInstalled as $aItem) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue