mirror of
https://github.com/friendica/friendica
synced 2024-11-10 07:02:54 +00:00
Merge pull request #12628 from nupplaphil/bug/typeerror
Don't ksort() or loop without an addon array
This commit is contained in:
commit
5fd3d4bda3
1 changed files with 9 additions and 5 deletions
|
@ -51,7 +51,7 @@ class Addon
|
|||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getAvailableList()
|
||||
public static function getAvailableList(): array
|
||||
{
|
||||
$addons = [];
|
||||
$files = glob('addon/*/');
|
||||
|
@ -81,10 +81,11 @@ class Addon
|
|||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getAdminList()
|
||||
public static function getAdminList(): array
|
||||
{
|
||||
$addons_admin = [];
|
||||
$addons = DI::config()->get('addons');
|
||||
$addons = DI::config()->get('addons') ?? [];
|
||||
|
||||
ksort($addons);
|
||||
foreach ($addons as $name => $data) {
|
||||
if (empty($data['admin'])) {
|
||||
|
@ -186,10 +187,12 @@ class Addon
|
|||
* reload all updated addons
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*
|
||||
*/
|
||||
public static function reload()
|
||||
{
|
||||
$addons = DI::config()->get('addons');
|
||||
$addons = DI::config()->get('addons') ?? [];
|
||||
|
||||
foreach ($addons as $name => $data) {
|
||||
$addonname = Strings::sanitizeFilePathItem(trim($name));
|
||||
|
@ -312,7 +315,8 @@ class Addon
|
|||
public static function getVisibleList(): array
|
||||
{
|
||||
$visible_addons = [];
|
||||
$addons = DI::config()->get('addons');
|
||||
$addons = DI::config()->get('addons') ?? [];
|
||||
|
||||
foreach ($addons as $name => $data) {
|
||||
$visible_addons[] = $name;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue