October CMS 包含一些命令行界面(CLI)命令和实用工具,它们允许您管理平台的各个方面,以及加快开发过程。这些控制台命令基于 Laravel 的Artisan 工具。您可以使用插件开发您自己的控制台命令。
october:update该 october:update 命令更新平台。它将更新核心应用程序和插件文件,然后执行一次数据库迁移。
php artisan october:update这与运行以下命令相同。
composer update
php artisan october:migrateoctober:migrateoctober:migrate 命令将执行数据库迁移,创建数据库表并执行种子脚本,这些脚本由系统和插件版本历史提供。迁移命令可以多次运行,它将只执行一次迁移或种子脚本,这意味着只应用新的更改。
php artisan october:migrate该 --rollback 选项将反转所有迁移,删除数据库表并删除数据。 使用此命令时应谨慎。 该 plugin:refresh 命令是调试单个插件的有用替代方案。
php artisan october:migrate --rollback--skip-errors 标志可用于抑制所有错误并强制完成迁移路径。使用此标志时应谨慎,因为某些错误对于确保数据完整性至关重要。
php artisan october:migrate --skip-errorsoctober:passwdoctober:passwd 命令允许通过命令行更改后端管理员的密码。如果您被锁定在 October CMS 安装之外,或者需要更改默认管理员账户的密码,这会很有用。
php artisan october:passwd username password对于第一个参数,您可以传入登录名或电子邮件地址。对于第二个参数,您可以选择传入所需的密码,否则您将被提示输入一个。
october:optimize该 october:optimize 将缓存框架和平台文件以提升性能。
php artisan october:optimizeproject:syncproject:sync 安装所有属于一个项目的插件和主题。
php artisan project:syncproject:setproject:set 为当前安装设置许可证密钥。
php artisan project:set <license key>plugin:installplugin:install - 下载并安装指定名称的插件。下一个示例将安装一个名为 AuthorName.PluginName 的插件。
php artisan plugin:install AuthorName.PluginName您可以从远程源使用--from选项安装一个插件。
php artisan plugin:install AuthorName.PluginName --from=git@github.com:authorname/pluginname-plugin.git使用 --want 选项来指定目标分支或版本。
php artisan plugin:install AuthorName.PluginName --from=git@github.com:authorname/pluginname-plugin.git --want=dev-develop使用 --oc 选项 如果你的包名带有 oc 前缀。
php artisan plugin:install AuthorName.PluginName --from=git@github.com:authorname/pluginname-plugin.git --ocplugin:checkplugin:check - 执行全系统范围的已安装插件依赖项检查。此命令将遍历当前安装的每个主题和插件,并检查其依赖项是否也已安装。如果发现任何缺失的要求,它将尝试安装它们。
php artisan plugin:check插件:刷新plugin:refresh - 销毁插件的数据库表并重新创建它们。此命令在开发时很有用。
php artisan plugin:refresh AuthorName.PluginName使用 --rollback 选项仅销毁数据库表而不重新创建它们。
php artisan plugin:refresh AuthorName.PluginName --rollback您也可以使用 --rollback 选项指定一个版本号,以停止在指定的版本。
php artisan plugin:refresh AuthorName.PluginName --rollback=1.0.3plugin:listplugin:list - 显示已安装插件的列表及其版本号。
php artisan plugin:listplugin:disableplugin:disable - 禁用一个现有插件。
php artisan plugin:disable AuthorName.PluginNameplugin:enableplugin:enable - 启用一个已禁用的插件。
php artisan plugin:enable AuthorName.PluginNameplugin:removeplugin:remove - 销毁插件的数据库表并从文件系统中删除插件文件。
php artisan plugin:remove AuthorName.PluginNametheme:installtheme:install - 下载并安装一个来自 市场 的主题。以下示例会将主题安装到 /themes/authorname-themename
php artisan theme:install AuthorName.ThemeName你可以从远程源安装一个主题 使用 --from 选项。
php artisan theme:install AuthorName.ThemeName --from=git@github.com:authorname/themename-theme.git使用 --want 选项来指定目标分支或版本。
php artisan theme:install AuthorName.ThemeName --from=git@github.com:authorname/themename-theme.git
```--want=dev-develop
Use the `--oc` option if your package name has the `oc` prefix.
```bash
php artisan theme:install AuthorName.ThemeName --from=git@github.com:authorname/oc-themename-theme.git --octheme:checktheme:check - 执行对主题的系统范围检查,以确定它们是否应被标记为只读并防止被更改。此命令将遍历每个主题,并检查它是否已使用 Composer 安装,如果是这样,一个主题锁定文件会被添加并且一个子主题会被创建。
php artisan theme:checktheme:listtheme:list - 列出已安装的主题。
php artisan theme:listtheme:usetheme:use - 切换活动主题。以下示例将切换到/themes/rainlab-vanilla中的主题
php artisan theme:use rainlab-vanillatheme:removetheme:remove - 删除一个主题。以下示例将删除目录 /themes/rainlab-vanilla
php artisan theme:remove rainlab-vanillatheme:copytheme:copy - 复制现有主题以创建一个新主题,包括创建子主题。
php artisan theme:copy <source-theme> [destination-theme]以下命令通过复制目录及其内容,从源主题 demo 创建一个名为 demo-copy 的新主题。在此过程中,.themelock 文件将被删除。
php artisan theme:copy demo demo-copy要创建继承父主题的子主题,请指定 --child 选项。
php artisan theme:copy demo demo-child --child如果使用 数据库驱动主题,您可以使用 --import-db 选项将数据库更改同步到文件系统.
php artisan theme:copy demo --import-db若要同时删除所有数据库模板,请使用 --purge-db 选项。
php artisan theme:copy demo --import-db --purge-dbcache:clearcache:clear - 清除应用程序、Twig 和组合器缓存目录。示例:
php artisan cache:clearoctober:freshoctober:fresh - 移除随 October CMS 附带的演示主题和插件。
php artisan october:freshoctober:mirroroctober:mirror - 将所有资产和资源文件镜像到 公共文件夹 使用符号链接。
php artisan october:mirroroctober:utiloctober:util - 一个通用命令,用于执行通用实用任务,例如清理文件或合并文件。传递给此命令的参数将决定所使用的任务。
输出用于 JavaScript (js)、样式表 (less)、客户端语言 (lang) 或所有内容 (assets) 的组合系统文件。
php artisan october:util compile assets
php artisan october:util compile lang
php artisan october:util compile js
php artisan october:util compile less若要不进行压缩地合并,请传入 --debug 选项。
php artisan october:util compile js --debug这将执行命令 git pull 在所有主题和插件目录中。
php artisan october:util git pull删除上传目录中所有生成的缩略图。
php artisan october:util purge thumbs删除 uploads 目录中不存在于 system_files 表中的文件。
php artisan october:util purge uploads删除 system_files 表中不属于任何其他模型的记录。
php artisan october:util purge orphans