You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suggestion, add a --all flag to wp cron delete #39
The workaroud I used was just clear the option (I know that's not foolproof if you use alternate crons)
Composability is nice mainly for wp post so you can do some pre filtering. Of if you want to run all wordfence crons or something like that.
Implementing a --all will not break that. It's just an extra function that's easier.
Also wp cron event run --all exists. Most of the wp plugin * and wp transient * have the --all flag.
@swissspidy I don't think your workaround would work, as the wp cron event delete command only accepts a single hook. You'd have to combine this with xargs to run multiple delete commands instead.
This then brings us to the reason why we should have a change here either way, as we'd want to avoid unnecessarily running multiple instances of WP-CLI if it is pretty straight-forward to do so.
In this case, that would mean to either accept multiple <hook> arguments as a variadic argument, or to provide something like --all instead.
Given what we have with other commands, and to stay consistent, I'd even suggest providing both.
This is less about removing composability, as it is about making an input argument "expressive" enough. So we're not adding new functionality to wp cron event delete, we're ensuring that the <hook> argument can be used for any combination of hooks you might want to delete: one hook, multiple hooks, all hooks.
Does that make sense, especially as it relates to the project's philosophy?
Activity
[-]Suggestion, add a --all flag[/-][+]Suggestion, add a --all flag to wp cron delete[/+]swissspidy commentedon Dec 3, 2018
Couldn't you just use
wp cron event list --fields=hook --format=csv | wp cron event delete?This better aligns with the WP-CLI project's philosophy: https://make.wordpress.org/cli/handbook/philosophy/#composability-is-always-a-good-idea
janw-me commentedon Dec 4, 2018
The workaroud I used was just clear the option (I know that's not foolproof if you use alternate crons)
Composability is nice mainly for
wp postso you can do some pre filtering. Of if you want to run all wordfence crons or something like that.Implementing a
--allwill not break that. It's just an extra function that's easier.Also
wp cron event run --allexists. Most of thewp plugin *andwp transient *have the--allflag.schlessera commentedon May 30, 2022
@swissspidy I don't think your workaround would work, as the
wp cron event deletecommand only accepts a single hook. You'd have to combine this withxargsto run multiple delete commands instead.This then brings us to the reason why we should have a change here either way, as we'd want to avoid unnecessarily running multiple instances of WP-CLI if it is pretty straight-forward to do so.
In this case, that would mean to either accept multiple
<hook>arguments as a variadic argument, or to provide something like--allinstead.Given what we have with other commands, and to stay consistent, I'd even suggest providing both.
This is less about removing composability, as it is about making an input argument "expressive" enough. So we're not adding new functionality to
wp cron event delete, we're ensuring that the<hook>argument can be used for any combination of hooks you might want to delete: one hook, multiple hooks, all hooks.Does that make sense, especially as it relates to the project's philosophy?
swissspidy commentedon May 30, 2022
Sure, it does 👍
Mike-Hermans commentedon Jun 2, 2022
I'll be picking up this issue today.