Hi.

I thought a little bit more about the pathauto interaction, and figured the best way to tackle it would involve a fundamental change. I'll explain in the first comment.

Thanks,
Al

Comments

captainack’s picture

If I'm understanding the flow of this module correctly, we are using the following sequence to achieve our content moderation goodness:

0 NEWREV: The node is saved as "published" and "create new revision"
1 NEWREV: We hook into presave and set aside the live revision information
2 NEWREV: We allow the new to-be-moderated revision to be published as usual, letting all other modules hook in and do their updates to the new revision
3 NEWREV: We hook into insert/update to do the sleight of hand, republishing the live version using manual table updates

Two things:
A) There's a slight window between 2 and 3 when the moderated revision (NEWREV) is live.
B) Other modules that hook into the update all believe the not-live revision is going live, and have no idea about step 3.

Point A is very minor, and so far the only I know of that point B makes a difference with is pathauto. I figured that we can address both points with the following updated sequence:

0 NEWREV: The node is saved as "UNpublished" and "create new revision"
1 NEWREV: We hook into presave and set aside the live revision information
2 NEWREV: We allow the new to-be-moderated revision to be published as usual, letting all other modules hook in and do their updates to the new revision
3 NEWREV: We hook into insert/update to:
i. node_load LIVEREV and set some flag for our module to back off and not touch the update
ii. do the sleight of hand, republishing the live version this time via node_save with "published" and without "create new revision".
4 LIVEREV: All other modules hook in as usual
5 NEWREV: No other modules are left to hook into the insert/update

The above sequence (namely, #5) will only be safe, and can only happen if we drastically change the weight of this module to be VERY heavy. I noticed that the .install already has a line setting the module to be weight 5, though. Would other parts of the code break if we made it much heavier?

One other thing is that we should probably update the node object passed in to that of the live revision, since it's passed by reference.

Any thoughts on this? Is this worth trying? I saw some comments in the code implying you might have already tried a similar approach but decided against it...

eugenmayer’s picture

Hi akhaef,

my time is a bit limitted the coming week so i try to focus on bugfixes. Reading your post superficially i think that you addition could be important.

eugenmayer’s picture

Status: Active » Fixed

Hi,

i took the work and reimplemented the nodeapi and the behavior. The code is on

http://github.com/EugenMayer/content_moderation

the check in is here.

http://github.com/EugenMayer/content_moderation/commit/56ced287634ad2268...

Check the commit message. Pathauto support is now implemented and working correctly.

captainack’s picture

Nice! I was gonna take a stab at it some time this week, but in looking at the changes you made to the code, I probably was underestimating the task.

Looks very slick. Can't wait to test it out! :)

-Al

eugenmayer’s picture

Status: Fixed » Closed (fixed)