Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of CRON functions in theme #146

Closed
dingo-d opened this issue May 31, 2018 · 10 comments
Closed

Usage of CRON functions in theme #146

dingo-d opened this issue May 31, 2018 · 10 comments
Milestone

Comments

@dingo-d
Copy link
Member

dingo-d commented May 31, 2018

We were going through the upstream sniffs during the meeting, especially through CronIntervalSniff, and we don't know whether to use it or not, because we don't have an agreement if we should allow cron jobs inside themes at all.

So a discussion is needed on this prefferably in the WPTRT meeting.

@justintadlock
Copy link

Cron jobs are plugin territory and not currently allowed in themes.

@dingo-d
Copy link
Member Author

dingo-d commented Jun 1, 2018

@jrfnl Feel free to exclude this sniff then :)

@dingo-d dingo-d closed this as completed Jun 1, 2018
@jrfnl
Copy link
Contributor

jrfnl commented Jun 1, 2018

Feel free to exclude this sniff then :)

Well, we just won't be adding the sniff.

However, this does raise another question: should there be a sniff that prohibits adding/touching cron ?
As in, a sniff which checks for cron jobs being added/altered/removed ?

@grappler
Copy link
Member

grappler commented Jun 2, 2018

As in, a sniff which checks for cron jobs being added/altered/removed ?

Yes, I think that would make sense as theme should not be running regular tasks.

@jrfnl jrfnl reopened this Jun 2, 2018
@justintadlock
Copy link

Team discussed this. Can this be combined with an existing sniff for disallowed functions? If that's the best route, take it. Otherwise, implement a specific sniff for this.

Meeting: https://wordpress.slack.com/archives/C02RP4Y3K/p1528822802001090

@jrfnl
Copy link
Contributor

jrfnl commented Jun 12, 2018

Thanks for the update. There will be one or more sniffs which will disallow functions, this is not included yet, but being worked on. If all that needs forbidding is functions, this will be included when I pull it.

Are there any cron hooks which should be forbidden too ?

@dingo-d
Copy link
Member Author

dingo-d commented Jun 13, 2018

We didn't mention specific hooks, but in general, all cron meddling in the theme should be forbidden.

@joyously
Copy link

Functions to disallow?
wp_schedule_event
wp_unschedule_hook
wp_reschedule_event
wp_unschedule_event
wp_clear_scheduled_hook
wp_schedule_single_event
wp_schedule_update_checks
wp_schedule_update_network_counts
wp_cron

@dingo-d
Copy link
Member Author

dingo-d commented May 18, 2019

Should this be in the ForbiddenFunctionsSniff or should I create a new sniff DisallowCRONUsageSniff ? Because it seems to me like cron is a plugin territory, and if this is correct, I can add those to the #215 PR 🙂

@dingo-d
Copy link
Member Author

dingo-d commented Jul 17, 2019

This has been merged in the develop branch and will be released with 0.2.0.

@dingo-d dingo-d closed this as completed Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants