diff --git a/src/Shell/AnnotationsShell.php b/src/Shell/AnnotationsShell.php index c4c962c5..16d1d481 100644 --- a/src/Shell/AnnotationsShell.php +++ b/src/Shell/AnnotationsShell.php @@ -81,7 +81,7 @@ public function startup(): void { * @return int */ public function callbacks() { - $paths = $this->getPaths(); + $paths = $this->getPaths('classes'); foreach ($paths as $path) { if (!is_dir($path)) { continue; @@ -809,6 +809,10 @@ protected function getPaths(?string $type = null): array { $plugin = (string)$this->param('plugin') ?: null; if (!$plugin) { if (!$type) { + return [ROOT . DS]; + } + + if ($type === 'classes') { return [ROOT . DS . APP_DIR . DS]; } @@ -820,9 +824,13 @@ protected function getPaths(?string $type = null): array { $paths = []; foreach ($plugins as $plugin) { if (!$type) { - $pluginPaths = [PluginPath::classPath($plugin)]; + $pluginPaths = [Plugin::path($plugin)]; } else { - $pluginPaths = $type === 'templates' ? App::path('templates', $plugin) : AppPath::get($type, $plugin); + if ($type === 'classes') { + $pluginPaths = [PluginPath::classPath($plugin)]; + } else { + $pluginPaths = $type === 'templates' ? App::path('templates', $plugin) : AppPath::get($type, $plugin); + } } foreach ($pluginPaths as $pluginPath) { $paths[] = $pluginPath; @@ -839,10 +847,25 @@ protected function getPaths(?string $type = null): array { */ protected function getPlugins(string $plugin): array { if (strpos($plugin, '*') === false) { - return [$plugin]; + return [Plugin::path($plugin) => $plugin]; + } + + $loaded = Plugin::loaded(); + $plugins = []; + foreach ($loaded as $name) { + $path = Plugin::path($name); + $rootPath = str_replace(ROOT . DS, '', $path); + if (strpos($rootPath, 'vendor' . DS) === 0) { + continue; + } + $plugins[$path] = $name; + } + + if ($plugin === 'all') { + return $plugins; } - return $this->filterPlugins(Plugin::loaded(), $plugin); + return $this->filterPlugins($loaded, $plugin); } /**