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 patch adds two features and fixes one bug that widen the range of ways third party modules can integrate with Scheduler;
- Implementations of
hook_scheduler_api()
can now receive$node
by reference. hook_scheduler_api()
is now also invoked before publishing and unpublishing with "pre_publish
" and "pre_unpublish
" actions respectively.- BUG: The
$node
object still haspublish_on
andunpublish_on
properties whenactions_do()
is called. This causes the value to be saved to the database again if any module that does an asynchronousnode_save()
with the$node
object.
These API features are useful and/or required by Scheduler Workbench Integration module to effectively integrate Scheduler with Workbench Moderation module. Specifically;
scheduler_workbench_scheduler_api()
can trigger moderation-state changes via the$node->workbench_moderation_state_new
property, which is more reliable, thorough and efficient than callingworkbench_moderation_moderate()
after the node is already published by scheduler. It also means that the node only passes through one moderation state transition instead of two.- Workbench Moderation has a
drupal_register_shutdown_function()
-callback whichnode_save()
s as drupal shuts down, restoringpublish_on
andunpublish_on
dates to thescheduler
table.
Related patch for Scheduler Workbench Integration module; #1660252: Publishing transitions twice through draft
Comment | File | Size | Author |
---|---|---|---|
#6 | 1660192-6-scheduler-external_integration.patch | 1.59 KB | pfrenssen |
#5 | 1660192-expand-options-03.patch | 1.57 KB | xtfer |
#4 | scheduler-external_integration-1660192.patch | 1.26 KB | rv0 |
#1 | more_integration_options.patch | 1.64 KB | Bevan |
Comments
Comment #1
Bevan CreditAttribution: Bevan commentedComment #2
Bevan CreditAttribution: Bevan commentedThis patch does not fix the bug in the case where both the publish and unpublish events for a node happen on the same cron run. I can not think of a fix for that scenario that is sufficiently unhacky to be worth contributing, without overhauling
scheduler_cron()
.Comment #3
acbramley CreditAttribution: acbramley commentedThis patch fixed an issue for me where the workbench state wasn't being set correctly on with scheduler_workbench
Comment #4
rv0 CreditAttribution: rv0 commented+1 for getting this committed.
one comment:
objects are always passed by reference so the "&" is not needed
repost with those lines removed:
Comment #5
xtfer CreditAttribution: xtfer commentedThe patch in #4 wouldn't apply for me. Kept telling me it was corrupt.
I've just rerolled it as is to try to fix that.
Comment #6
pfrenssenRerolled patch to latest dev and improved documentation.
Comment #7
rickmanelius CreditAttribution: rickmanelius commentedI'm slightly confused by the comment in #4. It was stated that & is not needed and then it's still in the patch.
Otherwise it looks good and will be committed once we can get clarification on this point.
Comment #8
pfrenssen@rickmanelius, that comment was about this hunk in the patch in #1. It was removed in #4 and subsequent patches:
Comment #9
rickmanelius CreditAttribution: rickmanelius commented@pfrenssen Dreditor must have been playing tricks on me because I can see the difference now. I'll get this applied tonight.
Comment #10
rickmanelius CreditAttribution: rickmanelius commentedJust committed #6. Thanks to everyone for their help in creating/reviewing this patch.
http://drupalcode.org/project/scheduler.git/commit/0212013
Comment #11.0
(not verified) CreditAttribution: commentedAdding reference to the patch that requires this