mirror of
https://github.com/Mibew/mibew.git
synced 2025-04-10 09:50:12 +03:00
Statically cache results of Plugin\Utils::discoverPlugins
This commit is contained in:
parent
dca7c2c520
commit
428c592139
@ -37,13 +37,17 @@ class Utils
|
||||
*/
|
||||
public static function discoverPlugins()
|
||||
{
|
||||
static $plugins = null;
|
||||
|
||||
if (is_null($plugins)) {
|
||||
$plugins = array();
|
||||
|
||||
$pattern = MIBEW_FS_ROOT . str_replace(
|
||||
'/',
|
||||
DIRECTORY_SEPARATOR,
|
||||
'/plugins/*/Mibew/Plugin/*/Plugin.php'
|
||||
);
|
||||
|
||||
$plugins = array();
|
||||
foreach (glob($pattern) as $plugin_file) {
|
||||
// Build plugin's name and validate it.
|
||||
$parts = array_reverse(explode(DIRECTORY_SEPARATOR, $plugin_file));
|
||||
@ -63,6 +67,7 @@ class Utils
|
||||
|
||||
$plugins[] = $plugin_name;
|
||||
}
|
||||
}
|
||||
|
||||
return $plugins;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user