Skip to content

Latest commit

 

History

History
253 lines (155 loc) · 10.5 KB

console-commands.md

File metadata and controls

253 lines (155 loc) · 10.5 KB

Command Line Interface

October includes several command-line interface (CLI) commands and utilities that allow to install October, update it, as well as speed up the development process. The console commands are based on Laravel's Artisan tool. You may develop your own console commands or speed up development with the provided scaffolding commands.

Console installation

Console installation can be performed using the native system or with Composer to manage dependencies. Either approach will download the October application files and can be used right away. If you plan on using a database, be sure to run the install command after installation.

Quick start install

Run this in your terminal to get the latest copy of October:

curl -s https://octobercms.com/api/installer | php

Or if you don't have curl:

php -r "eval('?>'.file_get_contents('https://octobercms.com/api/installer'));"

Composer install

Download the application source code by using create-project in your terminal. The following command will install to a directory called /myoctober.

composer create-project october/october myoctober

Once this task has finished, open the file config/cms.php and enable the disableCoreUpdates setting. This will disable core updates from being delivered by the October gateway.

'disableCoreUpdates' => true,

If you are actively developing a site and would like to get the latest and greatest changes for October when updating, then update the composer.json file to use the following; which enables you to test the latest improvements on the develop branch.

"october/rain": "dev-develop as 1.0",
"october/system": "dev-develop",
"october/backend": "dev-develop",
"october/cms": "dev-develop",
"laravel/framework": "5.5.*@dev",

When updating October, use the composer update command as normal before performing a database migration.

composer update

Composer is configured to look inside plugin directories for composer dependencies and these will be included in updates.

Note: To use composer with an October instance that has been installed using the Wizard installation, simply copy the tests/ directory, composer.json file and server.php file from GitHub into your October instance and then run composer install.

Setup & Maintenance

Install command

The october:install command will guide you through the process of setting up OctoberCMS for the first time. It will ask for the database configuration, application URL, encryption key and administrator details.

php artisan october:install

You also may wish to inspect config/app.php and config/cms.php to change any additional configuration.

Note: You cannot run october:install after running october:env. october:env takes the existing configuration values and puts them in the .env file while replacing the original values with calls to env() within the configuration files. october:install cannot now replace those calls to env() within the configuration files as that would be overly complex to manage.

System update

The october:update command will request updates from the October gateway. It will update the core application and plugin files, then perform a database migration.

php artisan october:update

Note: If you are using composer, the core application files will not be downloaded and composer update should be called before running this command. Additionally: If you are using composer to manage all of your dependencies (as opposed to the marketplace) then use october:up to run the pending migrations instead of october:update.

Database migration

The october:up command will perform a database migration, creating database tables and executing seed scripts, provided by the system and plugin version history. The migration command can be run multiple times, it will only execute a migration or seed script once, which means only new changes are applied.

php artisan october:up

The inverse command october:down will reverse all migrations, dropping database tables and deleting data. Care should be taken when using this command. The plugin refresh command is a useful alternative for debugging a single plugin.

php artisan october:down

Plugin management

October includes a number of commands for managing plugins.

Install plugin

plugin:install - downloads and installs the plugin by its name. The next example will install a plugin called AuthorName.PluginName. Note that your installation should be bound to a project in order to use this command. You can create projects on October website, in the Account / Projects section.

php artisan plugin:install AuthorName.PluginName

Refresh plugin

plugin:refresh - destroys the plugin's database tables and recreates them. This command is useful for development.

php artisan plugin:refresh AuthorName.PluginName

List Plugins

plugin:list - Displays a list of installed plugins.

php artisan plugin:list

Disable Plugin

plugin:disable - Disable an existing plugin.

php artisan plugin:disable AuthorName.PluginName

Enable Plugin

plugin:enable - Enable a disabled plugin.

php artisan plugin:enable AuthorName.PluginName

Remove plugin

plugin:remove - destroys the plugin's database tables and deletes the plugin files from the filesystem.

php artisan plugin:remove AuthorName.PluginName

Theme management

October includes a number of commands for managing themes.

Install theme

theme:install - download and install a theme from the Marketplace. The following example will install the theme in /themes/authorname-themename

php artisan theme:install AuthorName.ThemeName

If you wish to install the theme in a custom directory, simply provide the second argument. The following example will download AuthorName.ThemeName and install it in /themes/my-theme

php artisan theme:install AuthorName.ThemeName my-theme

List themes

theme:list - list installed themes. Use the -m option to include popular themes in the Marketplace.

php artisan theme:list

Enable theme

theme:use - switch the active theme. The following example will switch to the theme in /themes/rainlab-vanilla

php artisan theme:use rainlab-vanilla

Remove theme

theme:remove - delete a theme. The following example will delete the directory /themes/rainlab-vanilla

php artisan theme:remove rainlab-vanilla

Utilities

October includes a number of utility commands.

Clear application cache

cache:clear - clears the application, twig and combiner cache directories. Example:

php artisan cache:clear

Remove demo data

october:fresh - removes the demo theme and plugin that ships with October.

php artisan october:fresh

Mirror public directory

october:mirror - creates a mirrored copy of the public files needed to serve the application, using symbolic linking. This command is used when setting up a public folder.

php artisan october:mirror public/

Enable DotEnv configuration

october:env - changes common configuration values to DotEnv syntax.

php artisan october:env

Miscellaneous commands

october:util - a generic command to perform general utility tasks, such as cleaning up files or combining files. The arguments passed to this command will determine the task used.

Compile assets

Outputs combined system files for JavaScript (js), StyleSheets (less), client side language (lang), or everything (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

To combine without minification, pass the --debug option.

php artisan october:util compile js --debug

Pull all repos

This will execute the command git pull on all theme and plugin directories.

php artisan october:util git pull

Purge thumbnails

Deletes all generated thumbnails in the uploads directory.

php artisan october:util purge thumbs