cron-command icon indicating copy to clipboard operation
cron-command copied to clipboard

`wp cron event list` should show the actions for each event

Open johnbillion opened this issue 8 years ago • 7 comments

I just updated WP-Crontrol so it also shows the actions attached to each cron event. WP-CLI should do the same when you use wp cron event list.

johnbillion avatar Apr 05 '17 11:04 johnbillion

FYI - wp cron event list now lives in https://github.com/wp-cli/cron-command

danielbachhuber avatar Apr 05 '17 12:04 danielbachhuber

Also, wp profile has a get_name_location_from_callback that might be useful to abstract to WP_CLI\Utils: https://github.com/wp-cli/profile-command/blob/master/inc/class-profiler.php#L469

danielbachhuber avatar Apr 05 '17 15:04 danielbachhuber

Neat. Query Monitor has a pretty well battle-tested one too: https://github.com/johnbillion/query-monitor/blob/9b604e8972b09dad9ba17df84af5770118068fb6/classes/Util.php#L171-L252

johnbillion avatar Apr 05 '17 16:04 johnbillion

I realize this is a runcommand thing, but is it not the same as

wp hook the-cron-event-name

e.g.

wp cron event list
+---------------------+---------------------+-------------------+------------+
| hook                | next_run_gmt        | next_run_relative | recurrence |
+---------------------+---------------------+-------------------+------------+
| wp_version_check    | 2017-02-25 21:55:38 | now               | 12 hours   |
| wp_update_plugins   | 2017-02-25 21:55:38 | now               | 12 hours   |
| wp_update_themes    | 2017-02-25 21:55:38 | now               | 12 hours   |
| wp_scheduled_delete | 2017-02-25 21:57:15 | now               | 1 day      |
+---------------------+---------------------+-------------------+------------+

wp hook wp_version_check
+--------------------+---------------------------+----------+---------------+
| callback           | location                  | priority | accepted_args |
+--------------------+---------------------------+----------+---------------+
| wp_version_check() | wp-includes/update.php:24 | 10       | 1             |
+--------------------+---------------------------+----------+---------------+

@johnbillion are you suggesting a kind of combined table for combining the output of wp hook for each cron in the list?

aaemnnosttv avatar Apr 14 '17 12:04 aaemnnosttv

Yep!

johnbillion avatar Apr 14 '17 12:04 johnbillion

Could/should this be solved with documentation instead?

Use wp hook <hook> to inspect the callbacks on each event.

danielbachhuber avatar Aug 18 '17 19:08 danielbachhuber

Watch out for situations where one hook is scheduled 2000 times. The output in that circumstance probably needs to be truncated / sanitized.

javorszky avatar Oct 14 '17 20:10 javorszky