This is something we're running into in a big site with lots of imports and other actions happening outside of manual editing of nodes. Somehow nodes can get into a state which saves a new revision, but does not fix the current state it is in. So next cron-run, it saves another revision with the incorrect state.
Problem/Motivation
When there's a failure, the scheduler-hooks does not revert the state back to the previous state like the scheduler-module does with the timestamp-field.
Steps to reproduce
Create a node which is published and has an unpublish-on and -state set. Set the node to that state elsewhere (could be batch update in a view, or manually in database) and run the scheduler:cron.
The node now has an unpublish-on value but no unpublish_state value.
Proposed resolution
Move the code that clears out the state-value inside the try/catch inside the hooks and add a case-check for then it should (un)publish to the current state.
Remaining tasks
-
User interface changes
-
API changes
-
Data model changes
-
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
jonathan1055 commentedThanks @spadxiii for the MR.
Can you check what the behavior is on the 3.x branch, and open a new MR there. When complete, we can use MR49 for back-porting to 2.x
Comment #4
bkosborneI think this is essentially a duplicate of #3414656: Scheduler CRON fails when the moderation state is already in the target state.