Add cron_example to illustrate hook_cron
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | examples.cron_example_1289482_19.patch | 12.9 KB | mile23 |
| #18 | examples.cron_example_1289482_18.patch | 12.67 KB | rfay |
| #14 | examples.cron_example_1289482_14.patch | 8.67 KB | rfay |
| #3 | cron_example.info | 118 bytes | vegantriathlete |
| #3 | cron_example.module.txt | 2.93 KB | vegantriathlete |
Comments
Comment #1
vegantriathleteOkay, Randy I'm lost about how I'm supposed to create the patch. I'm in my git cloned repository. I'm on branch 6.x.-1.dev. I've done
git add cron_exampleandgit add cron_example/*. I've successfully (I think) donegit commit -m "Create the cron_example". I don't get anything when I rungit diff > create-cron-example-1289482-1.patch. It's just an empty file.So, I'm attaching the .info and .module files here. Check them out and let me know if you like them and what I need to do.
Comment #2
vegantriathleteForgot to change the status before.
Comment #3
vegantriathleteI have changed the access arguments to "administer site configuration" since I am using admin/reports/status/run-cron. I also corrected the name for the .info file.
Comment #4
mile23Nice.
Couple things: Need unix line endings, first of all.
Second, git diff with no other options will tell you what's changed between the current commit and the files. So if you've committed the changes, there's no difference. Helpful hints here: http://stackoverflow.com/questions/1191282/git-diff-commits-difference
Comment #5
rfayThanks so much for working on this!
The git patch instructions will work for you.
Essentially:
1. Make the new submodule.
2. Check it in
3. Diff against the original (git diff origin/7.x-1.x >/tmp/examples.cron_example.patch)
Comment #6
rfaymarked #1289488: Port cron_example to D7 as a duplicate; it already has some good work in it, but it makes sense for the whole process to happen here, and we should start with the D7 code. @vegantriathlete it seems to me like there's some really interesting cron + queue options in D7 - please make sure those get in here if that's core and not contrib.
Comment #7
vegantriathleteRandy,
I'm not sure what options (cron + queue) you want me to consider. Regardless, isn't it better to keep the hook_cron example as brain-dead simple as possible? Please provide more feedback.
Comment #8
vegantriathlete@Mile23: It's strange. I thought I have notepad++ set up to create unix line endings. Does this have to do with the encoding? Right now I have it set to encode in ANSI. I've successfully rolled patches using the setup before.
Maybe when I'm rolling the patch the diff function is taking care of the line endings for me. So, maybe when I roll this properly the issue will take care of itself.
Comment #9
vegantriathleteNote: I am playing with this a bit more to do some other things and I am noticing that the access arguments don't seem to be working the way I intended. This is not quite ready for prime time, yet.
Comment #10
vegantriathlete@rfay: Maybe you were talking about http://api.drupal.org/api/drupal/modules--system--system.api.php/functio.... That is a separate hook and I think we should do a separate example.
Comment #11
rfayThat's what I was thinking about, and it should be covered in the D7 version.
However, we do not do an example for every hook. We do examples on a concept by concept basis. Otherwise we'd have 253,456 examples, and nobody would bother any more.
Comment #12
vegantriathleteGotcha. I'll think about how to include the additional hook in the D7 version of the example.
Comment #13
rfayI'm taking a look at this.
Comment #14
rfayHere's a version including hook_cron_queue_info(). I think with tests and a bit of cleanup it should be OK.
Comment #16
rfayOops. Didn't realize this issue was set to 6.x. Had a 7.x info file.
Comment #17
rfay#14: examples.cron_example_1289482_14.patch queued for re-testing.
Comment #18
rfayAnd here it is with tests.
Comment #19
mile23Looks lovely. Could use some more obsessive comments, however. :-)
Here it is after coder and some doxy tweaks:
Comment #20
vegantriathleteSorry for being AWOL on this, guys. I've been swamped with work. Thanks for jumping in.
Comment #21
rfayCommitted with minor changes,
D8: http://drupalcode.org/project/examples.git/commitdiff/2efa0bf
D8: http://drupalcode.org/project/examples.git/commitdiff/5d9d3e5
Thanks to all!