mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 09:19:22 +02:00
Same for themes + commands
This commit is contained in:
parent
cfdbc2a8b2
commit
511e10e78b
3
ma
3
ma
@ -11,6 +11,7 @@ if(!IS_CLI) {
|
||||
require_once SYSTEM . 'functions.php';
|
||||
require_once SYSTEM . 'init.php';
|
||||
|
||||
use MyAAC\Plugins;
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
$application = new Application();
|
||||
@ -26,7 +27,7 @@ foreach ($commandsGlob as $item) {
|
||||
$application->add(new ($commandPre . $name));
|
||||
}
|
||||
|
||||
$pluginCommands = glob(PLUGINS . '*/commands/*.php');
|
||||
$pluginCommands = Plugins::getCommands();
|
||||
foreach ($pluginCommands as $item) {
|
||||
$application->add(require $item);
|
||||
}
|
||||
|
@ -122,12 +122,14 @@ class Plugins {
|
||||
}
|
||||
|
||||
$themes = [];
|
||||
$pluginThemes = glob(PLUGINS . '*/themes/*', GLOB_ONLYDIR);
|
||||
foreach ($pluginThemes as $path) {
|
||||
$path = str_replace(PLUGINS, 'plugins/', $path);
|
||||
$name = pathinfo($path, PATHINFO_FILENAME);
|
||||
foreach(self::getAllPluginsJson() as $plugin) {
|
||||
$pluginThemes = glob(PLUGINS . $plugin['filename'] . '/themes/*', GLOB_ONLYDIR);
|
||||
foreach ($pluginThemes as $path) {
|
||||
$path = str_replace(PLUGINS, 'plugins/', $path);
|
||||
$name = pathinfo($path, PATHINFO_FILENAME);
|
||||
|
||||
$themes[$name] = $path;
|
||||
$themes[$name] = $path;
|
||||
}
|
||||
}
|
||||
|
||||
if ($cache->enabled()) {
|
||||
@ -137,6 +139,31 @@ class Plugins {
|
||||
return $themes;
|
||||
}
|
||||
|
||||
public static function getCommands()
|
||||
{
|
||||
$cache = Cache::getInstance();
|
||||
if ($cache->enabled()) {
|
||||
$tmp = '';
|
||||
if ($cache->fetch('plugins_commands', $tmp)) {
|
||||
return unserialize($tmp);
|
||||
}
|
||||
}
|
||||
|
||||
$commands = [];
|
||||
foreach(self::getAllPluginsJson() as $plugin) {
|
||||
$pluginCommands = glob(PLUGINS . $plugin['filename'] . '/commands/*.php');
|
||||
foreach ($pluginCommands as $path) {
|
||||
$commands[] = $path;
|
||||
}
|
||||
}
|
||||
|
||||
if ($cache->enabled()) {
|
||||
$cache->set('plugins_commands', serialize($commands), 600);
|
||||
}
|
||||
|
||||
return $commands;
|
||||
}
|
||||
|
||||
public static function getHooks()
|
||||
{
|
||||
$cache = Cache::getInstance();
|
||||
|
Loading…
x
Reference in New Issue
Block a user