codilar / cli-process-management
一个magento扩展,允许magento管理员执行某些CLI命令
1.0.0
2023-07-03 15:24 UTC
This package is not auto-updated.
Last update: 2024-09-24 20:02:47 UTC
README
安装
composer require codilar/cli-process-management
以管理员身份运行命令
登录后,转到系统 > 工具 > CLI过程管理,查看可用命令列表。点击您想运行的命令的“执行”按钮
添加自定义命令
在您的 <custom_module>/etc/di.xml
中,将命令作为虚拟类型添加(或者我们也可以创建一个新的类,该类实现了 \Codilar\CliProcessManagement\Model\CommandInterface
)
<virtualType name="Codilar\CliProcessManagement\Model\Command\CrontabList" type="Codilar\CliProcessManagement\Model\Command\AbstractCommand">
<arguments>
<argument name="name" xsi:type="string">Crontab List</argument> <!-- The name of the command -->
<argument name="description" xsi:type="string">Lists the active crons for current user</argument> <!-- The description of the command -->
<argument name="command" xsi:type="string">crontab -l</argument> <!-- The command itself. It is run with Magento's root directory being the pwd -->
</arguments>
</virtualType>
然后,将您的新类注入到命令池中
<type name="Codilar\CliProcessManagement\Model\CommandPool">
<arguments>
<argument name="commands" xsi:type="array">
<item name="crontab-list" xsi:type="object">Codilar\CliProcessManagement\Model\Command\CrontabList</item>
</argument>
</arguments>
</type>
这就完成了!您的新命令现在可供管理员使用