Fix addons problem more elegant
This commit is contained in:
parent
9fb5b95b5e
commit
6aaf1ea5d4
1 changed files with 7 additions and 17 deletions
|
@ -51,7 +51,7 @@ class Addon
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function getAvailableList()
|
public static function getAvailableList(): array
|
||||||
{
|
{
|
||||||
$addons = [];
|
$addons = [];
|
||||||
$files = glob('addon/*/');
|
$files = glob('addon/*/');
|
||||||
|
@ -81,14 +81,10 @@ class Addon
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function getAdminList()
|
public static function getAdminList(): array
|
||||||
{
|
{
|
||||||
$addons_admin = [];
|
$addons_admin = [];
|
||||||
$addons = DI::config()->get('addons');
|
$addons = DI::config()->get('addons') ?? [];
|
||||||
|
|
||||||
if (empty($addons)) {
|
|
||||||
return $addons_admin;
|
|
||||||
}
|
|
||||||
|
|
||||||
ksort($addons);
|
ksort($addons);
|
||||||
foreach ($addons as $name => $data) {
|
foreach ($addons as $name => $data) {
|
||||||
|
@ -191,14 +187,12 @@ class Addon
|
||||||
* reload all updated addons
|
* reload all updated addons
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws \Exception
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public static function reload()
|
public static function reload()
|
||||||
{
|
{
|
||||||
$addons = DI::config()->get('addons');
|
$addons = DI::config()->get('addons') ?? [];
|
||||||
|
|
||||||
if (empty($addons)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($addons as $name => $data) {
|
foreach ($addons as $name => $data) {
|
||||||
$addonname = Strings::sanitizeFilePathItem(trim($name));
|
$addonname = Strings::sanitizeFilePathItem(trim($name));
|
||||||
|
@ -321,11 +315,7 @@ class Addon
|
||||||
public static function getVisibleList(): array
|
public static function getVisibleList(): array
|
||||||
{
|
{
|
||||||
$visible_addons = [];
|
$visible_addons = [];
|
||||||
$addons = DI::config()->get('addons');
|
$addons = DI::config()->get('addons') ?? [];
|
||||||
|
|
||||||
if (empty($addons)) {
|
|
||||||
return $visible_addons;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($addons as $name => $data) {
|
foreach ($addons as $name => $data) {
|
||||||
$visible_addons[] = $name;
|
$visible_addons[] = $name;
|
||||||
|
|
Loading…
Reference in a new issue