The Console - JCH Optimize plugin is used to run Command Line Interface (CLI) commands with the Joomla CLI application. One common use for this is for running CRON jobs. These are commands configured to run at scheduled times on your server. Your hosting provider should be able to get you up and running on configuring and using CRON jobs.
This plugin should be enabled on installation, but if you intend to run JCH Optimize commands using the CLI, you should ensure this plugin is enabled.
As of Joomla 4.0, Joomla comes with a CLI application that you access at
/cli/joomla.php
, relative to your site's root. So, to use the CLI application, you can run a
command like this on the command line:
/path/to/php /path/to/joomla/cli/joomla.php
This command will list information of the usage, options and the available commands registered with the Joomla CLI Application. Typically, to run a command provided by an extension you would run:
/path/to/php /path/to/joomla/cli/joomla.php namespace:command
As you can see, the command consists of a namespace section, which tends to be the name of the extension, and a command, separated by a semicolon. Some commands are also further separated by a semicolon.
The Recache feature can be run on the command line using the Joomla CLI Application with the Console - JCH Optimize plugin and the jchoptimize:recache command. To run the recache function, you use the following command:
/path/to/php /path/to/joomla/cli/joomla.php jchoptimize:recache [options]
To get a list of all the various options and description, run:
/path/to/php /path/to/joomla/cli/joomla.php help jchoptimize:recache
This will print:
Usage: jchoptimize:recache [options] Options: --delete-cache|--no-delete-cache Delete or do not delete the existing cache first. The default is to delete the cache first. -l, --crawl-limit=CRAWL-LIMIT The maximum number of URLs that will be crawled. -c, --concurrency=CONCURRENCY The number of URLs that will be crawled at the same time. -m, --max-depth=MAX-DEPTH Starting from the base URL, all the URLs found on that page will be crawled then all the URLs found on the crawled pages, and so on. This sets how deep the crawl will extend. --live-site[=LIVE-SITE] The URL to your site, e.g. https://www.example.com -h, --help Display the help information -q, --quiet Flag indicating that all output should be silenced -V, --version Displays the application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Flag to disable interacting with the user -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Help: jchoptimize:recache will crawl all the configured pages to recache the site with JCH Optimize. Usage: php joomla.php jchoptimize:recache
Tip | |
---|---|
If you already have the |
Note | |
---|---|
If any of the |
Note | |
---|---|
If you're still using Joomla 3, then the Console - JCH Optimize plugin won't be installed. However, a CLI script is provided at |