Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit 5fbca6f

Browse files
author
the-djmaze
committed
centralize some code to \SnappyMail\Repository::getEnabledPackagesNames()
1 parent d52f2ad commit 5fbca6f

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

snappymail/v/0.0.0/app/libraries/RainLoop/ActionsAdmin.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,9 +704,7 @@ private function pluginEnable(string $sName, bool $bEnable = true) : bool
704704

705705
$oConfig = $this->Config();
706706

707-
$sEnabledPlugins = $oConfig->Get('plugins', 'enabled_list', '');
708-
$aEnabledPlugins = \explode(',', \strtolower($sEnabledPlugins));
709-
$aEnabledPlugins = \array_map('trim', $aEnabledPlugins);
707+
$aEnabledPlugins = \SnappyMail\Repository::getEnabledPackagesNames();
710708

711709
$aNewEnabledPlugins = array();
712710
if ($bEnable)

snappymail/v/0.0.0/app/libraries/RainLoop/Plugins/Manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(\RainLoop\Actions $oActions)
3939
if ($this->bIsEnabled) {
4040
$sList = $oConfig->Get('plugins', 'enabled_list', '');
4141
if (\strlen($sList)) {
42-
$aList = \array_map('trim', \explode(',', $sList));
42+
$aList = \SnappyMail\Repository::getEnabledPackagesNames();
4343
foreach ($aList as $i => $sName) {
4444
$oPlugin = $this->CreatePluginByName($sName);
4545
if ($oPlugin) {

snappymail/v/0.0.0/app/libraries/snappymail/repository.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ public static function canUpdateCore() : bool
177177
&& \RainLoop\Api::Config()->Get('admin_panel', 'allow_update', false);
178178
}
179179

180+
public static function getEnabledPackagesNames() : array
181+
{
182+
return \array_map('trim',
183+
\explode(',', \strtolower(\RainLoop\Api::Config()->Get('plugins', 'enabled_list', '')))
184+
);
185+
}
186+
180187
public static function getPackagesList() : array
181188
{
182189
empty($_ENV['SNAPPYMAIL_INCLUDE_AS_API']) && \RainLoop\Api::Actions()->IsAdminLoggined();
@@ -185,9 +192,7 @@ public static function getPackagesList() : array
185192
$sError = '';
186193
$aList = static::getRepositoryData($bReal, $sError);
187194

188-
$aEnabledPlugins = \array_map('trim',
189-
\explode(',', \strtolower(\RainLoop\Api::Config()->Get('plugins', 'enabled_list', '')))
190-
);
195+
$aEnabledPlugins = static::getEnabledPackagesNames();
191196

192197
$aInstalled = \RainLoop\Api::Actions()->Plugins()->InstalledPlugins();
193198
foreach ($aInstalled as $aItem) {

0 commit comments

Comments
 (0)