Concrete CMS には、SSH などのコマンドラインから実行できるよう CLI ツールが標準装備されています。
デバッグに最適です。
その中で僕が個人的によく使うコマンドをまとめてみました。
基本形
cd [Concrete CMS インストール先]
(sudo -u nginx) concrete/bin/concrete [コマンド] [オプション] --env=XXXXX (環境変数)
v8 未満の場合は concret/bin/concrete5
となります。
nginx
や apache
ユーザーとして動かしている場合は、 sudo -u (nginx|apache)
を最初に入れるのが必須です。僕はよく nginx をインストールして使っているの sudo -u nginx がデフォだったりします。
インストール
インストール:インタラクティブ
インタラクティブに、DB情報、サイト名、ユーザーパスワードなどを順番にキーボードで入力していく。
concret/bin/concrete c5:install -i
インストール:config ファイル指定
デモサイトなどの定期利レットに最適! DB 情報など、あらかじめ入れていたファイルを指定してインストールを行うコマンドです。
concret/bin/concrete c5:install --config=[ファイルパス]
以下の様な、Concrete CMS のインストール情報を PHP ファイルとして保存し、読み込むことでインストールできるコマンドです。
<?php
return [
'db-server'=>'127.0.0.1',
'db-username'=>'DBユーザー名',
'db-password'=> 'DBパスワード',
'db-database'=> 'DB名',
'timezone' => 'Asia/Tokyo', // PHP タイムゾーン
'starting-point' => 'atomik_full', // スターティングポイント
'admin-email'=> 'admin メールアドレス',
'admin-password' => 'admin パスワード',
'language'=> 'ja_JP', // 管理画面の言語
'site-locale'=>'ja_JP', // サイトの言語
];
キャッシュ
文字通り、キャッシュをクリアします。
concret/bin/concrete c5:clear-cache
確認系
バージョン確認
インストールされているバージョンを確認します
concret/bin/concrete c5:config get concrete.version_installed
全部の情報を確認
管理画面 - システムと設定 - 環境情報 で見ることができる情報と同じ情報を、CLI で出力します。
concret/bin/concrete c5:info
アップデート系
メンテナンスモードオン・オフ
アップデート前のオンにしないと、コアファイルを書き換えて、サイトにアクセスされた瞬間に、アップデートスクリプトが走ってしまいます。メンテナンスモードをオンにしてからアップデートしましょう。
concret/bin/concrete c5:config -g set concrete.maintenance_mode true
concret/bin/concrete c5:config -g set concrete.maintenance_mode false
Doctrine Dev モード
アップデート前のオン、アップデート完了後のオフをお勧めします。
c5:config -g set concrete.cache.doctrine_dev_mode true
c5:config -g set concrete.cache.doctrine_dev_mode false
コアアップデート
concrete コアフォルダを書き換えたあとに実施します。
concret/bin/concrete c5:update
言語ファイルアップデート
concret/bin/concrete c5:language-install --update
DevOps
Doctrine エンティティ再生成
Concrete サイトをコピーして作業する際に、application/config/doctrine
の中にプロキシーファイルが存在しなければいけません。
前述の concrete.cache.doctrine_dev_mod
が true だとサイトが遅くなりますが常に生成します。
通常は false で、doctrine の中にプロキシーファイルが入っていなかったり、古いファイルのみが入っている場合だとエラーになります。
なので、以下のエンティティリフレッシュというコマンドを実行して doctrine の proxies ファイルを生成します。
concret/bin/concrete c5:entities:refresh
debug モードの ON/OFF
エラーの表示のオン・オフ
concret/bin/concrete c5:config -g set concrete.debug.display_errors true
concret/bin/concrete c5:config -g set concrete.debug.display_errors false
エラーの詳細表示を行う (= debug) 行わない (=message)
concret/bin/concrete c5:config -g set concrete.debug.detail "debug"
concret/bin/concrete c5:config -g set concrete.debug.detail "message"
CLI コマンド一覧
何も オプションをつけずに concrete/bin/concrete
コマンドを実行すると、その Concrete CMS サイトで実行可能な CLI コマンド一覧を出力してくれます。
追加でインストールされたコマンド一覧も出力されます。
9.2.4: V9 の標準コマンド一覧
concrete 9.2.4
Usage:
command [options] [arguments]
Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
completion Dump the shell completion script
help Display help for a command
list List commands
c5
c5:block-developer Develop/Create Block Types
c5:boards:refresh Add content to boards and board instances.
c5:clear-cache Clear the cache
c5:compare-schema Compares db.xml in Concrete XML schema, Concrete entities, and all installed package schemas and entities with the contents of the database and prints the difference.
c5:config Set or get configuration parameters.
c5:database:charset:set Set the character set and collation of a database connection.
c5:database:foreignkey:fix Fix the foreign keys.
c5:denylist:clear Clear denylist-related data
c5:entities:refresh Refresh the Doctrine database entities
c5:exec Execute a PHP script within the Concrete environment
c5:express:export Export express entries
c5:files:generate-identifiers Create unique identifiers for existing files.
c5:ide-symbols Generate IDE symbols
c5:info Get detailed information about this installation.
c5:install Install Concrete
c5:is-installed Check if Concrete is already installed
c5:job Run a Concrete job
c5:language-install [c5:install-language] Install or update Concrete languages
c5:package:install [c5:package-install|c5:install-package] Install a package
c5:package:pack [c5:package-pack|c5:pack-package] Process a package (expand PHP short tags, compile icons and translations, create zip archive)
c5:package:translate [c5:package-translate|c5:translate-package] Creates or updates translations of a Concrete package
c5:package:uninstall [c5:package-uninstall|c5:uninstall-package] Uninstall a Concrete package
c5:package:update [c5:package-update|c5:update-package] Update a Concrete package
c5:phpcs Check or fix the PHP coding style.
c5:reindex Reindex pages, files, users and express entities
c5:rescan-files Rescans all files in the file manager.
c5:reset Reset the Concrete installation, deleting files and emptying the database
c5:service Check or update the web server configuration
c5:sitemap:generate Generate the sitemap in XML format.
c5:theme:install Install a Concrete Theme
c5:update Runs all database migrations to bring the Concrete installation up to date.
c5:user-group:bulk-assign-users Bulk assign users to groups by a given CSV file.
concrete
concrete:scheduler:run Runs the task scheduler, dispatching any tasks whose time has come.
concrete:scheduler:run-dev Runs the task scheduler in the foreground every minute. Useful for development environments.
concrete:theme:activate Activate a theme.
concrete:theme:activate-skin Activate a theme skin.
dbal
dbal:import Import SQL file(s) directly to Database.
dbal:reserved-words Checks if the current database contains identifiers that are reserved.
dbal:run-sql Executes arbitrary SQL directly from the command line.
messenger
messenger:consume Consume messages
messenger:failed:remove Remove given messages from the failure transport
messenger:failed:retry Retry one or more messages from the failure transport
messenger:failed:show Show one or more messages from the failure transport
migrations
migrations:diff [diff] Generate a migration by comparing your current database to your mapping information.
migrations:execute [execute] Execute a single migration version up or down manually.
migrations:generate [generate] Generate a blank migration class.
migrations:migrate [migrate] Execute a migration to a specified version or the latest available version.
migrations:status [status] View the status of a set of migrations.
migrations:version [version] Manually add and delete migration versions from the version table.
orm
orm:clear-cache:metadata Clear all metadata cache of the various cache drivers
orm:clear-cache:query Clear all query cache of the various cache drivers
orm:clear-cache:region:collection Clear a second-level cache collection region
orm:clear-cache:region:entity Clear a second-level cache entity region
orm:clear-cache:region:query Clear a second-level cache query region
orm:clear-cache:result Clear all result cache of the various cache drivers
orm:convert-d1-schema [orm:convert:d1-schema] Converts Doctrine 1.x schema into a Doctrine 2.x schema
orm:convert-mapping [orm:convert:mapping] Convert mapping information between supported formats
orm:ensure-production-settings Verify that Doctrine is properly configured for a production environment
orm:generate-entities [orm:generate:entities] Generate entity classes and method stubs from your mapping information
orm:generate-proxies [orm:generate:proxies] Generates proxy classes for entity classes
orm:generate-repositories [orm:generate:repositories] Generate repository classes from your mapping information
orm:info Show basic information about all mapped entities
orm:mapping:describe Display information about mapped objects
orm:run-dql Executes arbitrary DQL directly from the command line
orm:schema-tool:create Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output
orm:schema-tool:drop Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output
orm:schema-tool:update Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata
orm:validate-schema Validate the mapping files
task
task:check-automated-groups Automatically add users to groups.
task:clear-cache Clears all caches.
task:clear-empty-workflow-progress Clear workflow notifications you can not approve or deny.
task:deactivate-users Deactivates users who haven't logged in recently, if automatic user deactivation is active.
task:generate-sitemap Creates sitemap.xml at the root of your site.
task:generate-thumbnails Recomputes all thumbnails for a file.
task:health:javascript Scans block and attribute content for custom JavaScript added to pages.
task:health:page-cache Checks page cache settings globally and on every page to determine whether they are optimally configured for use in a live, production environment.
task:health:production-status Scans your site and its settings to determine whether it is optimally configured for use in a live, production environment.
task:process-email Polls an email account and grabs private messages/postings that are sent there.
task:reindex-content Reindex pages, files, users and Express objects.
task:remove-old-file-attachments Removes all expired file attachments from private messages.
task:remove-old-page-versions Removes all except the 10 most recent page versions for each page.
task:remove-unvalidated-users Remove users who never validate their email address long time.
task:rescan-files Recomputes all attributes, clears and regenerates all thumbnails for a file.
task:update-statistics-trackers Scan the sitemap for file usage and stack usage to update statistics trackers.
V8 の標準コマンド一覧
concrete5 8.5.12
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
help Displays help for a command
list Lists commands
amazon-pay
amazon-pay:report:generate [amazon-pay:generate-report] Generate amazon pay report
c5
c5:blacklist:clear Clear blacklist-related data
c5:clear-cache Clear the concrete5 cache
c5:compare-schema Compares db.xml in concrete5 XML schema, concrete5 entities, and all installed package schemas and entities with the contents of the database and prints the difference.
c5:config Set or get configuration parameters.
c5:database:charset:set Set the character set and collation of a database connection.
c5:database:foreignkey:fix Fix the foreign keys.
c5:entities:refresh Refresh the Doctrine database entities
c5:exec Execute a PHP script within the concrete5 environment
c5:express:export Export express entries
c5:fill-thumbnails-table Populate the thumbnail table with all the files.
c5:ide-symbols Generate IDE symbols
c5:info Get server and concrete5 detailed informations.
c5:install Install Concrete CMS
c5:job Run a concrete5 job
c5:language-install [c5:install-language] Install or update concrete5 languages
c5:package:install [c5:package-install|c5:install-package] Install a concrete5 package
c5:package:pack [c5:package-pack|c5:pack-package] Process a package (expand PHP short tags, compile icons and translations, create zip archive)
c5:package:translate [c5:package-translate|c5:translate-package] Creates or updates translations of a concrete5 package
c5:package:uninstall [c5:package-uninstall|c5:uninstall-package] Uninstall a concrete5 package
c5:package:update [c5:package-update|c5:update-package] Update a concrete5 package
c5:phpcs Check or fix the PHP coding style.
c5:rescan-files Rescans all files in the file manager.
c5:reset Reset the concrete5 installation, deleting files and emptying the database
c5:service Check or update the web server configuration
c5:sitemap:generate Generate the sitemap in XML format.
c5:theme:install Install a Concrete5 Theme
c5:theme:values:fix Fix the theme customizable values.
c5:update Runs all database migrations to bring the concrete5 installation up to date.
dbal
dbal:import Import SQL file(s) directly to Database.
dbal:run-sql Executes arbitrary SQL directly from the command line.
dpz
dpz:generate:subscription-report [dpz:generate:subscription:report|dpz:generate:report:subscription] Generates subscription report of pay.jp and amazon pay for the day or a specific date.
md
md:logs:clear Clear Concrete CMS logs based on log channel, number of days to keep, and log level.
md:payjp:check-customers Check payjp customers
migrations
migrations:diff Generate a migration by comparing your current database to your mapping information.
migrations:execute Execute a single migration version up or down manually.
migrations:generate Generate a blank migration class.
migrations:migrate Execute a migration to a specified version or the latest available version.
migrations:status View the status of a set of migrations.
migrations:version Manually add and delete migration versions from the version table.
orm
orm:clear-cache:metadata Clear all metadata cache of the various cache drivers.
orm:clear-cache:query Clear all query cache of the various cache drivers.
orm:clear-cache:result Clear all result cache of the various cache drivers.
orm:convert-d1-schema [orm:convert:d1-schema] Converts Doctrine 1.X schema into a Doctrine 2.X schema.
orm:convert-mapping [orm:convert:mapping] Convert mapping information between supported formats.
orm:ensure-production-settings Verify that Doctrine is properly configured for a production environment.
orm:generate-entities [orm:generate:entities] Generate entity classes and method stubs from your mapping information.
orm:generate-proxies [orm:generate:proxies] Generates proxy classes for entity classes.
orm:generate-repositories [orm:generate:repositories] Generate repository classes from your mapping information.
orm:info Show basic information about all mapped entities
orm:mapping:describe Display information about mapped objects
orm:run-dql Executes arbitrary DQL directly from the command line.
orm:schema-tool:create Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output.
orm:schema-tool:drop Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output.
orm:schema-tool:update Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata.
orm:validate-schema Validate the mapping files.