CakePHP 3.x: 隐藏 shell class
CakePHP 3.x: hide shell class
我有一个 src/Shell/AppShell.php
class 扩展到所有其他 shell classes 并且包含所有其他 classes 使用的常用方法.
换句话说,这个 class 不包含任何可直接调用的方法。
如果我启动控制台:
bin/cake
class 被自动检测并显示:
$ bin/cake
Welcome to CakePHP v3.0.6 Console
[...]
Available Shells:
[...]
[MyPlugin] app, compress, install
[...]
$ bin/cake MeTools.app
Usage:
cake my_plugin.app [-h] [-v] [-q]
Options:
--help, -h Display this help.
--verbose, -v Enable verbose output.
--quiet, -q Enable quiet output.
如何隐藏它而不使其可执行?
谢谢。
正在通过扫描 shell 文件夹中的 .php
个文件来检索可用的 shell。
仅对主应用程序和核心中的 shell 列表进行了排除(AppShell
、CommandListShell
和 CompletionShell
被隐藏默认),插件 shell 列表不会被过滤,所以隐藏这样的 shell 的唯一方法是
- 使用非
.php
文件扩展名(这不是一个好主意,因为它会破坏默认的 PSR-4 自动加载器)
- 或将基础 shell class 移动到不同的目录(shell 文件夹中的子目录应该这样做)
我有一个 src/Shell/AppShell.php
class 扩展到所有其他 shell classes 并且包含所有其他 classes 使用的常用方法.
换句话说,这个 class 不包含任何可直接调用的方法。
如果我启动控制台:
bin/cake
class 被自动检测并显示:
$ bin/cake
Welcome to CakePHP v3.0.6 Console
[...]
Available Shells:
[...]
[MyPlugin] app, compress, install
[...]
$ bin/cake MeTools.app
Usage:
cake my_plugin.app [-h] [-v] [-q]
Options:
--help, -h Display this help.
--verbose, -v Enable verbose output.
--quiet, -q Enable quiet output.
如何隐藏它而不使其可执行? 谢谢。
正在通过扫描 shell 文件夹中的 .php
个文件来检索可用的 shell。
仅对主应用程序和核心中的 shell 列表进行了排除(AppShell
、CommandListShell
和 CompletionShell
被隐藏默认),插件 shell 列表不会被过滤,所以隐藏这样的 shell 的唯一方法是
- 使用非
.php
文件扩展名(这不是一个好主意,因为它会破坏默认的 PSR-4 自动加载器) - 或将基础 shell class 移动到不同的目录(shell 文件夹中的子目录应该这样做)