- // silently fail if addon was removed
-
- if (!file_exists('addon/' . $addon . '/' . $addon . '.php')) {
- return false;
- }
- logger("Addons: installing " . $addon);
- $t = @filemtime('addon/' . $addon . '/' . $addon . '.php');
- @include_once('addon/' . $addon . '/' . $addon . '.php');
- if (function_exists($addon . '_install')) {
- $func = $addon . '_install';
- $func();
-
- $addon_admin = (function_exists($addon."_addon_admin") ? 1 : 0);
-
- DBA::insert('addon', ['name' => $addon, 'installed' => true,
- 'timestamp' => $t, 'plugin_admin' => $addon_admin]);
-
- // we can add the following with the previous SQL
- // once most site tables have been updated.
- // This way the system won't fall over dead during the update.
-
- if (file_exists('addon/' . $addon . '/.hidden')) {
- DBA::update('addon', ['hidden' => true], ['name' => $addon]);
+ $addons = [];
+ $files = glob('addon/*/');
+ if (is_array($files)) {
+ foreach ($files as $file) {
+ if (is_dir($file)) {
+ list($tmp, $addon) = array_map('trim', explode('/', $file));
+ $info = self::getInfo($addon);
+
+ if (DI::config()->get('system', 'show_unsupported_addons')
+ || strtolower($info['status']) != 'unsupported'
+ || self::isEnabled($addon)
+ ) {
+ $addons[] = [$addon, (self::isEnabled($addon) ? 'on' : 'off'), $info];
+ }
+ }