Skip to content

Commit 2ce63df

Browse files
Generate a README
1 parent 0379fa8 commit 2ce63df

File tree

1 file changed

+282
-0
lines changed

1 file changed

+282
-0
lines changed

README.md

Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
wp-cli/cron-command
2+
===================
3+
4+
Manage WP-Cron events and schedules.
5+
6+
[![Build Status](https://travis-ci.org/wp-cli/cron-command.svg?branch=master)](https://travis-ci.org/wp-cli/cron-command)
7+
8+
Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing)
9+
10+
## Using
11+
12+
This package implements the following commands:
13+
14+
### wp cron test
15+
16+
Test the WP Cron spawning system and report back its status.
17+
18+
~~~
19+
wp cron test
20+
~~~
21+
22+
This command tests the spawning system by performing the following steps:
23+
24+
* Checks to see if the `DISABLE_WP_CRON` constant is set; errors if true
25+
because WP-Cron is disabled.
26+
* Checks to see if the `ALTERNATE_WP_CRON` constant is set; warns if true.
27+
* Attempts to spawn WP-Cron over HTTP; warns if non 200 response code is
28+
returned.
29+
30+
**EXAMPLES**
31+
32+
# Cron test runs successfully.
33+
$ wp cron test
34+
Success: WP-Cron spawning is working as expected.
35+
36+
37+
38+
### wp cron event delete
39+
40+
Delete the next scheduled cron event for the given hook.
41+
42+
~~~
43+
wp cron event delete <hook>
44+
~~~
45+
46+
**OPTIONS**
47+
48+
<hook>
49+
The hook name.
50+
51+
**EXAMPLES**
52+
53+
# Delete the next scheduled cron event
54+
$ wp cron event delete cron_test
55+
Success: Deleted 2 instances of the cron event 'cron_test'.
56+
57+
58+
59+
### wp cron event list
60+
61+
List scheduled cron events.
62+
63+
~~~
64+
wp cron event list [--fields=<fields>] [--<field>=<value>] [--field=<field>] [--format=<format>]
65+
~~~
66+
67+
**OPTIONS**
68+
69+
[--fields=<fields>]
70+
Limit the output to specific object fields.
71+
72+
[--<field>=<value>]
73+
Filter by one or more fields.
74+
75+
[--field=<field>]
76+
Prints the value of a single field for each event.
77+
78+
[--format=<format>]
79+
Render output in a particular format.
80+
---
81+
default: table
82+
options:
83+
- table
84+
- csv
85+
- ids
86+
- json
87+
- count
88+
- yaml
89+
---
90+
91+
**AVAILABLE FIELDS**
92+
93+
These fields will be displayed by default for each cron event:
94+
* hook
95+
* next_run_gmt
96+
* next_run_relative
97+
* recurrence
98+
99+
These fields are optionally available:
100+
* time
101+
* sig
102+
* args
103+
* schedule
104+
* interval
105+
* next_run
106+
107+
**EXAMPLES**
108+
109+
# List scheduled cron events
110+
$ wp cron event list
111+
+-------------------+---------------------+---------------------+------------+
112+
| hook | next_run_gmt | next_run_relative | recurrence |
113+
+-------------------+---------------------+---------------------+------------+
114+
| wp_version_check | 2016-05-31 22:15:13 | 11 hours 57 minutes | 12 hours |
115+
| wp_update_plugins | 2016-05-31 22:15:13 | 11 hours 57 minutes | 12 hours |
116+
| wp_update_themes | 2016-05-31 22:15:14 | 11 hours 57 minutes | 12 hours |
117+
+-------------------+---------------------+---------------------+------------+
118+
119+
# List scheduled cron events in JSON
120+
$ wp cron event list --fields=hook,next_run --format=json
121+
[{"hook":"wp_version_check","next_run":"2016-05-31 10:15:13"},{"hook":"wp_update_plugins","next_run":"2016-05-31 10:15:13"},{"hook":"wp_update_themes","next_run":"2016-05-31 10:15:14"}]
122+
123+
124+
125+
### wp cron event run
126+
127+
Run the next scheduled cron event for the given hook.
128+
129+
~~~
130+
wp cron event run [<hook>...] [--due-now] [--all]
131+
~~~
132+
133+
**OPTIONS**
134+
135+
[<hook>...]
136+
One or more hooks to run.
137+
138+
[--due-now]
139+
Run all hooks due right now.
140+
141+
[--all]
142+
Run all hooks.
143+
144+
**EXAMPLES**
145+
146+
# Run all cron events due right now
147+
$ wp cron event run --due-now
148+
Success: Executed a total of 2 cron events.
149+
150+
151+
152+
### wp cron event schedule
153+
154+
Schedule a new cron event.
155+
156+
~~~
157+
wp cron event schedule <hook> [<next-run>] [<recurrence>] [--<field>=<value>]
158+
~~~
159+
160+
**OPTIONS**
161+
162+
<hook>
163+
The hook name.
164+
165+
[<next-run>]
166+
A Unix timestamp or an English textual datetime description compatible with `strtotime()`. Defaults to now.
167+
168+
[<recurrence>]
169+
How often the event should recur. See `wp cron schedule list` for available schedule names. Defaults to no recurrence.
170+
171+
[--<field>=<value>]
172+
Associative args for the event.
173+
174+
**EXAMPLES**
175+
176+
# Schedule a new cron event
177+
$ wp cron event schedule cron_test
178+
Success: Scheduled event with hook 'cron_test' for 2016-05-31 10:19:16 GMT.
179+
180+
# Schedule new cron event with hourly recurrence
181+
$ wp cron event schedule cron_test now hourly
182+
Success: Scheduled event with hook 'cron_test' for 2016-05-31 10:20:32 GMT.
183+
184+
# Schedule new cron event and pass associative arguments
185+
$ wp cron event schedule cron_test '+1 hour' --foo=1 --bar=2
186+
Success: Scheduled event with hook 'cron_test' for 2016-05-31 11:21:35 GMT.
187+
188+
189+
190+
### wp cron schedule list
191+
192+
List available cron schedules.
193+
194+
~~~
195+
wp cron schedule list [--fields=<fields>] [--field=<field>] [--format=<format>]
196+
~~~
197+
198+
**OPTIONS**
199+
200+
[--fields=<fields>]
201+
Limit the output to specific object fields.
202+
203+
[--field=<field>]
204+
Prints the value of a single field for each schedule.
205+
206+
[--format=<format>]
207+
Render output in a particular format.
208+
---
209+
default: table
210+
options:
211+
- table
212+
- csv
213+
- ids
214+
- json
215+
- yaml
216+
---
217+
218+
**AVAILABLE FIELDS**
219+
220+
These fields will be displayed by default for each cron schedule:
221+
222+
* name
223+
* display
224+
* interval
225+
226+
There are no additional fields.
227+
228+
**EXAMPLES**
229+
230+
# List available cron schedules
231+
$ wp cron schedule list
232+
+------------+-------------+----------+
233+
| name | display | interval |
234+
+------------+-------------+----------+
235+
| hourly | Once Hourly | 3600 |
236+
| twicedaily | Twice Daily | 43200 |
237+
| daily | Once Daily | 86400 |
238+
+------------+-------------+----------+
239+
240+
# List id of available cron schedule
241+
$ wp cron schedule list --fields=name --format=ids
242+
hourly twicedaily daily
243+
244+
## Installing
245+
246+
Installing this package requires WP-CLI v0.23.0 or greater. Update to the latest stable release with `wp cli update`.
247+
248+
Once you've done so, you can install this package with `wp package install wp-cli/cron-command`.
249+
250+
## Contributing
251+
252+
We appreciate you taking the initiative to contribute to this project.
253+
254+
Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.
255+
256+
### Reporting a bug
257+
258+
Think you’ve found a bug? We’d love for you to help us get it fixed.
259+
260+
Before you create a new issue, you should [search existing issues](https://github.com/wp-cli/cron-command/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.
261+
262+
Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/cron-command/issues/new) with the following:
263+
264+
1. What you were doing (e.g. "When I run `wp post list`").
265+
2. What you saw (e.g. "I see a fatal about a class being undefined.").
266+
3. What you expected to see (e.g. "I expected to see the list of posts.")
267+
268+
Include as much detail as you can, and clear steps to reproduce if possible.
269+
270+
### Creating a pull request
271+
272+
Want to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/cron-command/issues/new) to discuss whether the feature is a good fit for the project.
273+
274+
Once you've decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it's a pleasant experience:
275+
276+
1. Create a feature branch for each contribution.
277+
2. Submit your pull request early for feedback.
278+
3. Include functional tests with your changes. [Read the WP-CLI documentation](https://wp-cli.org/docs/pull-requests/#functional-tests) for an introduction.
279+
4. Follow the [WordPress Coding Standards](http://make.wordpress.org/core/handbook/coding-standards/).
280+
281+
282+
*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*

0 commit comments

Comments
 (0)