Skip to main content

Using the CLI

The Command Line Interface (CLI)

If you have terminal access to the server hosting your website, you can leverage the Origen CLI (Command Line Interface) to perform routine tasks without requiring Origen user login credentials. Even in cases where terminal access is not available, such as on shared hosting accounts, you can execute CLI commands using cron jobs. CLI commands often offer faster and more convenient alternatives to equivalent actions performed through the Origen (or cPanel) Backend interface. Examples of tasks where choosing the CLI is preferable include site backup and managing the site's online/offline status.

The Origen core provides approximately 30 useful commands, and you can extend its capabilities by adding additional extensions. For instance, you can retrieve external data, such as Geolocation or Exchange rate data, for a custom application.

Using the CLI

To utilize the CLI, you need to invoke the command line PHP executable. This executable is typically distinct from the one used by a web server like Apache. If you are employing a cron job, you may need to provide the complete path to the PHP executable, as shown below:

/usr/local/bin/php /home/username/public_html/[optional subfolder]/cli/origen.php

Alternatively, when using the terminal command line, navigate to the Origen CLI directory and start executing commands without specifying any parameters:

cd /home/username/public_html/[optional subfolder]/cli
php origen.php

Cli List

To familiarize yourself with the CLI, you can try out some help commands to understand their functionality:

php origen.php help
php origen.php list
php origen.php help cache:clean
php origen.php help config:get

You can also experiment with some simple action commands::

php origen.php config:get debug
php origen.php cache:clean
php origen.php site:down
php origen.php site:up

Options

When invoking commands from a cron job, you might want to suppress any output:

php origen.php -q cache:clean

Please note that options can be specified using either a space or an equal sign, but variables must use an equal sign:

php origen.php session:gc --application backend
php origen.php session:gc --application=backend
php origen.php config:set debug=true

Commands

Here is a brief explanation of each core command.

Cache

Clears expired entries from the system cache:

php origen.php cache:clean --help

Cache Help

php origen.php cache:clean

Clean Cache

php origen.php cache:clean expired

Clean expired cache

Config

Retrieve or modify a configuration variable, which can be either an individual variable defined in configuration.php or a group of variables. The supported groups include db, session, and mail.

php origen.php config:get debug --help
php origen.php config:get debug

Debug state

php origen.php config:set debug=true

Enable Debug

php origen.php config:get --group session

Get Session Config

Core

Check for updates or update Origen.

php origen.php core:check-updates --help
php origen.php core:check-updates

Check For update

php origen.php core:update --help
php origen.php core:update

Database

Perform the export or import of the database. It is possible to export or import either all tables or a specific table. However, caution should be exercised when using this feature to import all tables of a multi-lingual site, as it may result in an issue that can cause the Smart Search functionality to cease functioning entirely.

php origen.php database:export --help
php origen.php database:export --table f4rc2_banners --folder /home/username/tmp/mydb (one table)
php origen.php database:export --folder /home/username/tmp/mydb (all tables)

php origen.php database:import --help
php origen.php database:import --table /home/username/tmp/mydb/f4rc2_banners (one table)
[ERROR] The /home/username/tmp/mydb/f4rc2_banners.xml file does not exist.
php origen.php database:import --folder /home/username/tmp/mydb (all tables in this folder)

Extension

List, Discover, Install or Remove applications.

php origen.php extension:list --help
php origen.php extension:list
php origen.php extension:list --type app
php origen.php extension:list --type file
php origen.php extension:list --type language
php origen.php extension:list --type library
php origen.php extension:list --type widget
php origen.php extension:list --type package
php origen.php extension:list --type extender
php origen.php extension:list --type template

php origen.php extension:discover --help
php origen.php extension:discover
php origen.php extension:discover:list
php origen.php extension:discover:install --eid=

php origen.php extension:install --help
php origen.php extension:install --path=
php origen.php extension:install --url=

php origen.php extension:remove --help
php origen.php extension:remove

Finder

This operation purges and rebuilds the index, while ensuring that search filters are retained throughout the process.

php origen.php finder:index --help

Indexer Help

php origen.php finder:index
php origen.php finder:index purge

Reindex

Scheduler

This functionality allows users to perform various operations related to scheduled tasks. These operations include listing the available tasks, changing the state (e.g., enabling or disabling) of tasks, and manually triggering the execution of scheduled tasks.

php origen.php scheduler:list --help
php origen.php scheduler:list

php origen.php scheduler:state --help
php origen.php scheduler:state (interactive prompt for task id)

php origen.php scheduler:run --help
php origen.php scheduler:run --id ID
php origen.php scheduler:run --all

Session

This operation executes session garbage collection, which involves removing expired or invalid session data from the system. Garbage collection helps optimize session storage and ensures efficient memory usage.

php origen.php session:gc --help
php origen.php session:gc
php origen.php session:gc --application backend
php origen.php session:metadata:gc --help
php origen.php session:metadata:gc

Site

This functionality allows you to toggle the online/offline state of the website. It enables you to put the site in either an offline or online mode, controlling whether it is accessible to users or temporarily unavailable.

php origen.php site:down --help
php origen.php site:down
php origen.php site:up --help
php origen.php site:up

Update

This operation checks for any pending updates for extensions installed in the system. It identifies and removes outdated files that should have been deleted during an Origen update process. This helps maintain the integrity of the system by ensuring that only the latest and relevant files are present, eliminating any remnants of previous versions.

php origen.php update:extensions:check --help
php origen.php update:extensions:check
php origen.php update:origen:remove-old-files --help
php origen.php update:origen:remove-old-files

Cli-list

User

List and manage users.

php origen.php user:list --help
php origen.php user:list

Cli-list

php origen.php user:add --help
php origen.php user:add --username walid --name Walid --email walid@localhost --usergroup Manager (prompt for password)
php origen.php user:add (prompts for data)
php origen.php user:addtogroup --help
php origen.php user:addtogroup (prompts for data)
php origen.php user:addtogroup --usernam=walid --group=Manager
php origen.php user:removefromgroup --help
php origen.php user:removefromgroup (prompts for data)
php origen.php user:removefromgroup --usernam=walid --group=Manager
php origen.php user:reset-password --help
php origen.php user:reset-password (prompts for data)
php origen.php user:reset-password --username=walid (prompts for password)
php origen.php user:delete --help
php origen.php user:delete (prompts for username)
php origen.php user:delete --username=walid (prompts for confirmation - y to confirm)