Jun 24

OctoberCMS useful CLI commands

There are needs when you want to quickly install or update something without using web-ui alternatively you want to build tool to automate some process. In those times this cli commands are useful.

lets check them out

OctoberCMS CLI commands

Change Backend User Password

Solution of : How to reset backend-User password ?

This is the main question once we forgot backend password. here is the solution of it.

This Command will reset backend user password
php artisan october:passwd "username" "password"
You may provide the username or email as username.

if you are still stuck check this tutorial for other ways to reset bakend user password.

System Level Commands

Update OctoberCMS

To update OctoberCMS Directly from command line you can use this command.

This Command will update the core application and plugin files, then perform a database migration.
php artisan october:update

Database operations

Database Operations - migrate all data

This db migration command can be run multiple times, it will only execute a migration or seed script once, which means only new changes are applied.

Performs data migration, Plugins tables are createad if its not already migrated.
php artisan october:up

Plugin management operations

Install plugin

At some point we need to install plugin then this command will be at help.

This command will downloads and installs the plugin by its name
php artisan plugin:install {AuthorName}.{PluginName}
Replace AuthorName with author's name and PluginName with plugin you want to insall.

List Plugins

This command will displays a list of installed plugins.
php artisan plugin:list

Disable Plugin

This command will disable an existing plugin.
php artisan plugin:disable {AuthorName}.{PluginName}
Before disabling plugin please check if you are not using any of it's components in pages otherwise it will show error on your working pages.

Enable Plugin

This command will enable a disabled plugin..
php artisan plugin:enable {AuthorName}.{PluginName}

Remove plugin

This command will destroys the plugin's database tables and deletes the plugin files from the filesystem.
php artisan plugin:remove {AuthorName}.{PluginName}
Make sure you are not using any of its functinality before removing it.

Plugins and Themes development operations

Refresh plugin

When you are developing plugin often you need to re-test it again and again. if your plugin is using database tables then we show old records there each time. to clear them you can use this command.

This command will destroys the plugin's database tables and deletes the plugin files from the filesystem.
php artisan plugin:refresh {AuthorName}.{PluginName}
Double check plugin name before refreshing it as it may drop datatables and recreates them so, that data will be lost if you used different plugin's name.

Pull all repos

If you are working remote server with git repositories for plugins and themse then this command is for you.

Once you develop your themes and plugins you may need to push those changes to the server you can use this command.

This command will execute the command git pull on all theme and plugin directories.
php artisan october:util git pull

Cache commands

Clear Cache

Some time when you modify your code and it did not reflected on frontend so may its due to caching. so its good idea to clear cache to check if we are not stuck because of cache

This command will clears the application, twig and combiner cache directories.
php artisan cache:clear

Purge thumbnails

If you are using thumnail generation in your code most often then you may use this command. sometime you ended up creating thumbs which you dont use any more so to create thumb cache may help you to free some of space and needed thumbs will be regenerate again.

This command will deletes all generated thumbnails in the uploads directory.
php artisan october:util purge thumbs