Apparently moderating the live revision to a non-published state doesn't actually unpublish it.

Comments

johanh’s picture

Category: feature » bug

I have the same problem. Isn't this a bug?

cweagans’s picture

Priority: Normal » Major

I spent some time debugging this and I know what the problem is, but I don't know how to fix it.

Here's the problem:

revision_scheduler queues up a bunch of stuff to do on hook_cron, then hook_cron_queue_info takes care of actually executing it.

The cron queue worker for revision scheduler (defined in revision_scheduler_cron_queue_info) is revision_scheduler_operation_process(), which loads data about the operation from the database and executes it. In our case, the operation callback is workbench_moderation_moderate().

workbench_moderation_moderate() expects that there is data in $node->workbench_moderation['my_revision'] (line 1429 of workbench_moderation.module). That data really should be there because revision_scheduler_operation_process() loads the entity data with revision_scheduler_entity_revision_load(), which calls entity_load().

workbench_moderation implements hook_node_load() and calls workbench_moderation_node_data() on each node being loaded, and workbench_moderation_node_data() is what would actually add the data that workbench_moderation_moderate() is looking for.

Instead, though, $node->workbench_moderation['my_revision'] is empty in workbench_moderation_moderate(), which messes up the $new_revision object on line 1440 of workbench_moderation.module, which, in turn, messes up pretty much everything from line 1475 to 1505 in workbench_moderation.module.

cweagans’s picture

So the problem on our site was that the content types that we were trying to schedule weren't actually dealt with by workbench. We just needed a regular unpublish action. There's a patch for that here: #1828646: Provide a regular publish/unpublish revision operation (without workbench)

arpieb’s picture

Status: Active » Needs review
StatusFileSize
new961 bytes

We're running into the same thing, which is due to the fact that workbench_moderation_moderate doesn't handle unpublishing a revision, which is part of the actual state transition to an unpublished state.

This patch introduces a revision to the moderation state change operation to properly leverage a new workbench_moderation unpublish function added via patch in #1781852: Function to expire and unpublish content if available; otherwise the code should act as always.

mstef’s picture

Looks like it's working fine for me -- combined with the referenced patch.

gmclelland’s picture

Note: There is also patches in #1828646: Provide a regular publish/unpublish revision operation (without workbench) that provide similar functionality.

Can anyone tell me if those patches in #1828646: Provide a regular publish/unpublish revision operation (without workbench) make these patches unnecessary?

Maybe you just need the patch here if your are using workbench moderation??

jgalletta’s picture

Issue summary: View changes

Patch from comment #4 is working for me too, combined with the referenced patch.