It looks like this module is not being actively maintained, but I am very interested in porting it to Drupal 7.
Would you be interested in moving the HEAD to 7.x version (I am working on the patch currently to bring this module up to the Drupal 7 standards)? Or are you planning to abandon this module in favor of some other (Revisioning etc)?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Azol’s picture

Assigned: Unassigned » Azol
Status: Active » Needs review
FileSize
20.94 KB

Okay, here is the first patch to bring HEAD up to the D7 coding standards. There are several bugs, so do not try it on production website - this is not even alpha version! Feel free to post your findings here (no feature requests, please!), I will try to do some further troubleshooting soon.

binford2k’s picture

I get this error on enabling the module. It ends up enabled and adds the "revisions in moderation" checkbox, but doesn't seem to prevent the revision from being immediately visible.

Azol’s picture

I still awaiting for module developer to commit the patch to open the 7.x branch, so we can begin creating patches against it. There is already Revisioning module with similar functionality (no D7 port yet).
Is this module going to be abandoned (40 weeks without any commiits on module page)? If so, I would prefer to switch to Revisioning and help getting it up to shape real quick.
I tried to contact current maintainer (jbrauer) but got no reply.

binford2k’s picture

I am also hoping for the Revisioning port, but in the short term I was going to try this. I was sad when it didn't work. You mentioned known bugs in your patch. Do you mind listing them here so we can begin working through them?

Azol’s picture

You can just use Coder module to start ironing out the rest of the problems.

Here is the updated patch, try it and report if it's working.

Azol’s picture

Okay, here is the actual patch

Azol’s picture

Further changes to make the install process error-free

binford2k’s picture

It did indeed install error free :)

Getting the same issues though. The original revision is marked as current if you view the rev history, but the latest one is actually displayed. I haven't had a chance to get to any code today, but I hope to have some time to look at it tomorrow.

binford2k’s picture

OK, it's pretty simple, actually. The solution though...not so simple. I'm still thinking about that.

The module is working exactly as designed. The problem is that node_save() saves the new node content at the same time it saves the revision.

We have two options here:

  • We can save the revision in hook_node_presave() and then munge the node back to original contents. We'd have to prevent Drupal from then saving yet another revision.
  • We can save the original content back over the node in our existing hook_node_update() function. This is what I'm attempting to do now, with the code below, but it doesn't seem to be working right.
          $onode = $node->original_node;
          $onode->vid = $node->vid;
          drupal_write_record('node', $onode, 'nid');
          _node_save_revision($onode, $onode->uid, 'vid');
    

I'll keep you updated and let you know when I get it working.

Azol’s picture

This sounds like a workaround, but I would not recommend it, esp. direct use of _node_save_revision, which may cause unpredictable results when combined with some other node manipulation modules.

The main problem with this module logic is that

if ($node->vid != $current_vid)

always resolves to FALSE, at least in D7 version (I have never used D6 version). And I would surely prefer the revision_moderation column to hold current $node->vid value instead of just "0" or "1" flag.

My best advice would be waiting a bit for the maintainer answer, and if there is none, to switch to Revisioning module.

rafal_p_s’s picture

Hello there.
From 5-6h i'm trying to patch that module and include it to D7.
I'm changing somethings what u dont see.
But still dunn work.

Do u have any new suggestions ?

binford2k’s picture

This patch works fully as far as I can tell. The key was figuring out how the new fields system worked. Run my patches with -p1. The first patch is against HEAD, the second is against the patch in #7.

This cleans up a bunch of minor style issues too.

It does have one possibly major bug--seen on the content type page--, and a handful of problem areas. All are identified by coder. Once I figure out the logic in revision_moderation_form_alter, I'll attempt to migrate it to hook_form_FORM_ID_alter() and fix that one.

binford2k’s picture

Azol’s picture

Thanks, binford2k! Will give your patch a try...

binford2k’s picture

This moves the config link from the admin bar on top into config/content where it should be.

Azol’s picture

Here is the final patch, incorporating all the changes made by me and binford2k, with patch file format changed to match the Drupal requirements... feel free to check it out and post any possible issues in this thread.

BenK’s picture

Subscribing

benanderson’s picture

subscribing

rafal_p_s’s picture

@Azol
That patch is for what version of RM ?
because on revision_moderation 6.x-1.x-dev
i have a lot of errors in

patch -p1 < 995876-revision_moderation_d7_1.patch

f.e. in http://localhost/admin/content/node/revisions

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''50'' at line 1: SELECT n.nid, r.vid, n.type, r.title, r.uid, r.timestamp FROM {node} n INNER JOIN {node_revision} r ON n.nid = r.nid WHERE r.vid > n.vid ORDER BY r.vid DESC LIMIT :limit; Array ( [:limit] => 50 ) w revision_moderation_get_all_pending_revisions() (line 372 z /var/www/modules/revision_moderation/revision_moderation.module).

Azol’s picture

Thanks for report, I shall check it out.

Patch is for HEAD branch (http://drupalcode.org/viewvc/drupal/contributions/modules/revision_moder...).

didox’s picture

subscribing

rafal_p_s’s picture

On apply that patch I dont have any errors.
But RM still doesnt work clear.
http://localhost/admin/content/node/revisions

give me that error msg
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''50'' at line 1: SELECT n.nid, r.vid, n.type, r.title, r.uid, r.timestamp FROM {node} n INNER JOIN {node_revision} r ON n.nid = r.nid WHERE r.vid > n.vid ORDER BY r.vid DESC LIMIT :limit; Array ( [:limit] => 50 ) w revision_moderation_get_all_pending_revisions() (line 396 z /var/www/drupal7/modules/revision_moderation/revision_moderation.module).

Btw sql query

SELECT n.nid, r.vid, n.type, r.title, r.uid, r.timestamp FROM node n INNER JOIN node_revision r ON n.nid = r.nid WHERE r.vid > n.vid ORDER BY r.vid DESC LIMIT 50

really give me 0

binford2k’s picture

Try replacing the parameter with a hardcoded value and see if the error goes away. I'm unable to replicate it on pgsql and sqlite.

$result = db_query('SELECT n.nid, r.vid, n.type, r.title, r.uid, r.timestamp FROM {node} n INNER JOIN {node_revision} r ON n.nid = r.nid WHERE r.vid > n.vid ORDER BY r.vid DESC LIMIT 50');

Azol’s picture

I got it figured out, should use db_query_range instead of normal db_query when using LIMIT
Here is the updated FULL patch against the HEAD.

benanderson’s picture

subscribing

jbrauer’s picture

Version: 6.x-1.x-dev » master
Status: Needs review » Needs work

Thanks for the work on this. It definitely looks like a great start. I should have more time to look at it this weekend. One thing I don't see offhand is any mention of hook_schema_alter to work with the moderate field in the node table if it's already present or add it if it's not.

Azol’s picture

Thanks for update, jbrauer!
To answer your question about Moderate field: it was dropped from D7 schema:
http://drupal.org/update/modules/6/7#moderate_column

jbrauer’s picture

Exactly which is why it's necessary to use hook_schema_alter in order to maintain backwards compatibility. Note that because it was dropped from the schema does not mean that it won't be present for D6 module users upgrading to the D7 version.

Azol’s picture

Now this module does not change Moderate column for nodes in any way (as far as I know) - just retains the value it contains. Wouldn't it be a good point to drop this unsupported feature?
I would say the port would be great for D7 users from the beginning and it would be possible to add the upgrade path later on. Just my 2cp.
Performance wise, it holds good potential to change the module logic in the future versions, so the revision_moderation table would contain actual $node->vid, not just the 0/1 flag, to keep db_query() to an absolute minimum.

binford2k’s picture

The current version w/ patches applied now errors if you click the publish link within the revision view. It works fine when you use the revert link in the list of all revisions.

Are you sure you want to publish this revision for ?
Error message
Notice: Trying to get property of non-object in revision_moderation_publish_confirm() (line 439 of /ld/www/htdocs/sys/sops/sites/all/modules/revision_moderation/revision_moderation.module).
Notice: Trying to get property of non-object in revision_moderation_publish_confirm() (line 440 of /ld/www/htdocs/sys/sops/sites/all/modules/revision_moderation/revision_moderation.module).
Notice: Trying to get property of non-object in revision_moderation_publish_confirm() (line 441 of /ld/www/htdocs/sys/sops/sites/all/modules/revision_moderation/revision_moderation.module).
Notice: Trying to get property of non-object in revision_moderation_publish_confirm() (line 442 of /ld/www/htdocs/sys/sops/sites/all/modules/revision_moderation/revision_moderation.module).
Notice: Trying to get property of non-object in revision_moderation_publish_confirm() (line 444 of /ld/www/htdocs/sys/sops/sites/all/modules/revision_moderation/revision_moderation.module).
Notice: Trying to get property of non-object in revision_moderation_publish_confirm() (line 444 of /ld/www/htdocs/sys/sops/sites/all/modules/revision_moderation/revision_moderation.module).
Notice: Trying to get property of non-object in revision_moderation_publish_confirm() (line 444 of /ld/www/htdocs/sys/sops/sites/all/modules/revision_moderation/revision_moderation.module).
binford2k’s picture

This patch fixes my last post. The edit link is still broken, but I don't have time to finish it today. I'll fix it on Monday.

binford2k’s picture

well that was more of a pain in the ass than I expected.

bforchhammer’s picture

subscribing

carwin’s picture

subscribe

branana’s picture

This patch is to make it so that nodes created before revision_moderation module is installed can work with revision_moderation too. This is based on comment HEAD + comment #24, #31, #32

knaffles’s picture

subscribe

bforchhammer’s picture

Which branch are the patches in this thread based on? HEAD, 7.x-1.x, 6.x-1.x?

Azol’s picture

HEAD.

I will take some time to create a new consolidated patch, but I REALLY HOPE that jbrauer will finally create new 7.x branch, so we can patch against it.

bforchhammer’s picture

Okay, attached is a new patch against the (git) master branch incorporating #24, #31, #32 and #35.

Overall the port seems to be working nicely; two things I found while testing the patch:

  • When viewing an unpublished revision the "status message" says "by Anonymous" instead of my username.
    You are currently viewing a revision of this post created on Sat, 02/26/2011 - 16:26 by Anonymous (not verified).
  • When I activate the diff module (7.x-1.x-dev) I cannot open the revisions page anymore (blank page). The error message is:
    Warning: Parameter 1 to diff_diffs_overview() expected to be a reference, value given in menu_execute_active_handler() (line 501 of /var/www/bf_d7test/public_html/includes/menu.inc).
  • It is currently possible to "revert" unpublished revisions... The "revisions" page should probably show a "publish" operation instead of the "revert" operation.
binford2k’s picture

Grumble. Apparently this module cannot handle more than one file either! I'll start working on fixing that on Friday.

binford2k’s picture

I've moved over to http://drupal.org/project/workbench_moderation, which is much nicer than this module.

Azol’s picture

Thanks for your great input and help, binford2k. It's a strange thing that there are at least 3 modules doing mostly the same, considering the "Drupal way" of opening new projects over existing ones.

binford2k’s picture

And they're all in different states of working or almost working now too!

jbrauer’s picture

Thanks binford2k for mentioning http://drupal.org/project/workbench_moderation

I spoke with Bec last week at Drupalcon and unless something unforeseen comes up I see workbench moderation as the way forward. The plan will be to write a conversion for sites moving from Revision Moderation in Drupal 6 to workbench moderation in Drupal 7 but there is enough overlap that it doesn't seem to make sense to keep both modules going forward.

binford2k’s picture

Thanks for combining forces! I think that's a great plan and I'll be happy to help. There are still some missing features (such as Rules support) that I want to add to WBM. I'm using some lessons I learned from reading your code to get WBM in a state that I could use it.

Alex Andrascu’s picture

Would be wonderfull to have an upgrade path from Revision Moderation 6.x to Workbench 7.x if this is going to happen.
Otherwise it makes sense.
Great job with this module. Total life saver for me.

giorgio79’s picture

Inquired at Workbench Moderation on how to mimic Revision Moderation functionality:
#1136134: Update path from Revision Moderation

catch’s picture

Coming here from #542290: Make it easier to create draft revisions in core.

This module currently updates the vid in hook_node_update().

As you know this doesn't work in Drupal 7 due to Field API's model of always keeping the latest revision.

I ran into this on http://drupal.org/node/282122#comment-1927444 and that comment has working code (at least it worked on the time), which instead of munging the vid, clones the 'active' revision, saves the new one, then adds the active revision back to the top of the list. It is a workaround, but it's arguably no more of a workaround than changing vids around with direct database queries.

It should be possible to do that workflow without a core patch, but if it's not we could try to add helper functions (such as node_delete_revision() from that patch) to core to make it easier.

Azol’s picture

Status: Needs work » Closed (won't fix)

Based on #44 and #48 I believe we can safely close this issue, as further porting of this module will require extensive reworking of the module logic. If anyone believes that this work should continue, feel free to reopen it. Moving on to Workbench Moderation.

RdeBoer’s picture

As mentioned on the Revision Moderation project page, if you like the style of this module, Revisioning may be a better fit, as it has its origins in Revision Moderation and a similar, but improved, UI. Over the last couple of years Revisioning has evolved a lot further than Revision Moderation.
Revisioning version is available now for both 6.x and 7.x