Problem/Motivation

While adding new cron tasks for different sites, normally the code gets sent to different environments and everything needs to be automated, so a drush command to discover new jobs would come in handy, so far normally I just clicked the "Discover jobs" button, but that adds a manual step.

By now I get by just with this drush command:
drush php-eval "\Drupal::service('ultimate_cron.discovery')->discoverCronJobs();"

Proposed resolution

But would be nice to have something specific for the module or maybe an argument for some of the already existing commands to include it, for example executing something like:
drush cron-list --discover-jobs

If that sounds something we could agree on I could create a patch for that.

Comments

icampana created an issue. See original summary.

prudloff’s picture

We would also be interested in a patch that does this.
It would feel cleaner than having to call php-eval.

prudloff’s picture

Status: Active » Needs review
StatusFileSize
new2 KB

The attached patch adds a new drush cron-discover command.

tunic’s picture

Status: Needs review » Reviewed & tested by the community

Patch works ok, the command is available and runs withouts issues.

berdir’s picture

Status: Reviewed & tested by the community » Needs work

Doesn't apply anymore.

chandreshgiri gauswami’s picture

Status: Needs work » Needs review
StatusFileSize
new1.8 KB

Re-rolled patch.

tunic’s picture

Status: Needs review » Reviewed & tested by the community

Tested and working ok, command is available and works without issues.

berdir’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

Conflicts on constructor changes that I had to commit for drush 13 compatibility.

That said, I also just committed #3317033: discover cron jobs on cache rebuild rather than module install?, so I'm not sure if this is still needed, you can just clear caches now.

prudloff’s picture

Indeed, discovering when rebuilding the cache would be enough for our use case.

prudloff’s picture

angel.h’s picture

StatusFileSize
new2.08 KB

I have created a patch specific for 2.0alpha7 (not alpha8) to comply with PHP 8.2 and 8.3 since dynamic declarations of properties is deprecated in PHP8.2.

dieterholvoet’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.