Skip to content
Snippets Groups Projects
README.md 2.43 KiB
Newer Older
Erick Hitter's avatar
Erick Hitter committed
# WP-CLI Cron Control Offload #
**Contributors:** ethitter, automattic  
**Tags:** wp-cli, cli, cron, cron control  
**Requires at least:** 4.8.1  
**Tested up to:** 4.9  
**Requires PHP:** 7.0  
Erick Hitter's avatar
Erick Hitter committed
**Stable tag:** 0.1.0  
**License:** GPLv2 or later  
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html  

Schedule WP-CLI tasks to run via Cron Control

## Description ##

Erick Hitter's avatar
Erick Hitter committed
Offload WP-CLI requests to cron, to be executed via (Cron Control)[https://github.com/Automattic/Cron-Control] and its CLI runner.
Erick Hitter's avatar
Erick Hitter committed

Erick Hitter's avatar
Erick Hitter committed
Provides a WP-CLI command to schedule these events. A UI is under consideration.
Erick Hitter's avatar
Erick Hitter committed

## Installation ##

Erick Hitter's avatar
Erick Hitter committed
1. Upload the `wp-cli-cron-control-offload` directry to the `/wp-content/plugins/` directory
Erick Hitter's avatar
Erick Hitter committed
1. Activate the plugin through the 'Plugins' menu in WordPress

## Frequently Asked Questions ##

### Why is PHP 7 required? ###

To support arrays in constants set using `define()`, PHP 7 is required. These are used to set whitelists and blacklists, though filters are also provided; see below.

Erick Hitter's avatar
Erick Hitter committed
### Does this support custom WP-CLI commands? ###
Erick Hitter's avatar
Erick Hitter committed

Yes. By default, no restrictions are placed on what commands are supported, as those restrictions depend on the environment where this plugin is used. That said, see the following sections regarding support for whitelists and blacklists.

### Can I dynamically block commands? ###

Yes, using the `wp_cli_cron_control_offload_is_command_allowed` filter. Note that the blacklist described below takes precedence over this filter (the filter is ignored). Additionally, if a whitelist is provided, the filter uses it as the default.

### Can commands be blocked or blacklisted? ###

Yes, using either the `WP_CLI_CRON_CONTROL_OFFLOAD_COMMAND_BLACKLIST` constant or the `wp_cli_cron_control_offload_command_blacklist` filter. If defined, the constant takes precedence and the filter is ignored.

Regardless of whether the constant or filter is used, either should provide an array of top-level commands to permit:

```
array(
	'post',
	'site',
)
```

### Can commands be restricted or whitelisted? ###

Yes, using either the `WP_CLI_CRON_CONTROL_OFFLOAD_COMMAND_WHITELIST` constant or the `wp_cli_cron_control_offload_command_whitelist` filter. If defined, the constant takes precedence and the filter is ignored.

Regardless of whether the constant or filter is used, either should provide an array of top-level commands to block:

```
array(
	'cli',
	'core',
	'eval',
	'eval-file',
)
```
Erick Hitter's avatar
Erick Hitter committed

## Changelog ##

Erick Hitter's avatar
Erick Hitter committed
### 0.1.0 ###
* Initial release