Based on the success of the separate project-usage-process.php script from #326197: Empty data for latest week and the general desire on d.o to rip stuff out of hook_cron() into separate scripts that can be invoked independently, the process of auto-closing issues that have been fixed for 2 weeks seems like another good candidate. It'd also help avoid the problems where we get duplicate auto-close comments when cron dies early.
However, it'd be nice to leave this inside hook_cron() on sites that don't have the same hook_cron() problems that d.o does. So, I imagine something like:
- Put the actual code into an issue_autoclose.inc file.
- Have project_issue_cron() check a setting (defaults to TRUE) to see if it should load this include file and invoke it
- Write a little project-issue-autoclose.php script that bootstraps Drupal, loads the include file, and invokes it.
- Document that if sites what to handle this functionality with an external cron job, they should set the setting to FALSE, configure the script properly, and have a cron job that invokes it daily.
Sound good?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 348563_pi_separate_cron.3.patch | 18.41 KB | dww |
| #1 | 348563_pi_separate_cron.1.patch | 18.44 KB | dww |
Comments
Comment #1
dwwActually, I just put all the relevant code into includes/cron.inc, including all the periodic email related stuff (no sense leaving that in hook_cron() on sites that want this separate), and took a first small step towards a reasonable page/code split while I was at it. ;) Completely untested, but I think this is what we need.
Comment #2
dwwPut this on p.d.o and haven't seen any trouble. I'd have to hack some things to force it to auto-close something, but since it's all exactly the same code just moved into a new file, I'm not going to bother. I'm getting hunmonk to give this a quick look, and then I'm going to open a ticket with the OSUOSL to add the cron job...
Comment #3
dwwhunmonk and I chatted and thought the variable should be renamed (and the logic inverted) to "project_issue_hook_cron" (defaults to TRUE, set to FALSE if you want to run the separate CLI script yourself). Otherwise, no changes here.
Comment #4
dwwFYI, see #351888: Add new cron job on www1 for project-issue-cron.php about getting a cron job for this running on www1.
Comment #5
dwwhunmonk was happy, so I committed to HEAD and DRUPAL-5--2, and deployed on d.o. Once #351888: Add new cron job on www1 for project-issue-cron.php is done, I'll add
'project_issue_hook_cron' => FALSEto settings.php and this will be live.