Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is a fairly simple callback, but it does have the ability to throw exceptions. There's also a patch for 8.x to have it through different classes of exception, which will add complexity. Hence worth documenting. Patch coming!
Comment | File | Size | Author |
---|---|---|---|
#24 | interdiff.txt | 714 bytes | David_Rothstein |
#24 | 2208649-24.patch | 2.19 KB | David_Rothstein |
#23 | interdiff.txt | 807 bytes | David_Rothstein |
#23 | 2208649-23.patch | 2.18 KB | David_Rothstein |
#19 | 2208649-18.patch | 2.35 KB | areke |
Comments
Comment #1
joachim CreditAttribution: joachim commented(The different exceptions patch is #1524550: queue cron workers can't signal a broken queue.)
Comment #2
Crell CreditAttribution: Crell commentedComment #3
jhodgdonNice! Thanks!
Comment #4
jhodgdonCommitted to 8.x. Thanks again!
Comment #6
joachim CreditAttribution: joachim commentedLet's backport this to 7. Tagging as novice.
Comment #7
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedHere is patch for D7.
Comment #8
joachim CreditAttribution: joachim commentedThanks! Looks great.
Comment #9
jhodgdonThanks again, and sorry for the delay -- committed to 7.x.
Comment #11
joachim CreditAttribution: joachim commentedOops. Looks like this has got placed into the hooks topic rather than callbacks!
Comment #12
jhodgdonAh, well it should be a quick patch to move it? Thanks for noticing...
Comment #13
jhodgdonTo clarify:
Inside system.api.php, there is an "@addtogroup callbacks".
The callback defined in this patch, callback_queue_worker(), needs to be moved from its present location in that file to inside the addtogroup callbacks section.
Comment #14
areke CreditAttribution: areke commentedComment #15
David_Rothstein CreditAttribution: David_Rothstein commentedI think there's a couple other things to fix in the original patch also:
"PHP callable" isn't true unless you're running PHP 5.4 or higher - otherwise it must be a standard function, at least for now. See #2342667: Cron and batch processing of queues are not accepting callables
The leading slash isn't correct for Drupal 7.
That's really not correct for Drupal 7 :) It should be node_save().
Comment #16
areke CreditAttribution: areke commentedHow's this?
Comment #17
areke CreditAttribution: areke commentedComment #19
areke CreditAttribution: areke commentedSilly me :P
Comment #20
joachim CreditAttribution: joachim commentedLooks good.
Comment #21
David_Rothstein CreditAttribution: David_Rothstein commentedDo we really want to remove the reference to callback_queue_worker()? If we do it seems like it would be a lot harder for people to find it in the documentation.
Comment #22
joachim CreditAttribution: joachim commentedOh yes you're right! That needs to be linked to.
Comment #23
David_Rothstein CreditAttribution: David_Rothstein commentedHere's a new version to move this along. This just uses similar phrasing to what's used for other callbacks in system.api.php.
Comment #24
David_Rothstein CreditAttribution: David_Rothstein commentedI actually see a couple more problems here - see the interdiff.
Comment #25
jhodgdonLooks fine to me!
Comment #26
jhodgdonDavid: do you want me to commit this one? If so assign it to me.
Comment #27
David_Rothstein CreditAttribution: David_Rothstein commentedNah, I can go ahead and take care of it.
Committed to 7.x - thanks!