Just curious as to how easy/hard it would be to integrate this module Node Revision Reference. Or if perhaps this should be a separate module.

It may be too difficult to implement, and potentially not worth it due to the small popularity of Node Revision Reference. But thought I'd just enquire.

Comments

bverc’s picture

Status: Active » Needs work
StatusFileSize
new4.71 KB

After working on this for a short time, I have a working solution. I'm not sure how stable it is, but it works.

The biggest change was to the nodereferrer_referrers() function. I would have preferred to the send the node object through, however in order to keep backwards compatibility with other modules that call this function, I added $node->vid as the last (optional) argument.

I haven't tested view integration yet, that will need some work too I assume.

Lastly, as I'm working on a postgres db, this patch assumes the #926918: Postgres compatibility patch #7 has been applied.

bverc’s picture

I'm stuck with views. when I add a relationship using a revision reference field. I get the following error:

   * warning: pg_query() [function.pg-query]: Query failed: ERROR: column node2.left does not exist LINE 9: ...EFT JOIN content_field_drupal_mod node2 ON node.nid = node2. ^ in /home/brendan/projects/archimedes/includes/database.pgsql.inc on line 140.
    * user warning: query: SELECT node_revisions.vid AS vid, node_data_field_mod_version.field_mod_version_value AS node_data_field_mod_version_field_mod_version_value, node.nid AS node_nid, node.type AS node_type, node.vid AS node_vid, node.title AS node_title FROM node_revisions node_revisions LEFT JOIN node node ON node_revisions.nid = node.nid LEFT JOIN content_field_drupal_mod node2 ON node.nid = node2. LEFT JOIN node node_node ON node2.vid = node_node.vid LEFT JOIN content_field_mod_version node_data_field_mod_version ON node_revisions.vid = node_data_field_mod_version.vid WHERE node.nid = 1880 LIMIT 10 OFFSET 0 in /home/brendan/projects/archimedes/sites/all/modules/contrib/views/includes/view.inc on line 771.

I can see the error is caused by the incomplete query where ON node.nid = node2. LEFT JOIN, but i am unsure where this error is caused. This could potentially be a bug outside of this patch, as a incomplete query like this shouldn't happen.

@andypost, i may need your expertise here.

acbramley’s picture

Applied patch and functions as expected. The cache can throw it off a bit though. Also getting the same error as above.

andypost’s picture

Is this patch still valid? I have no PG installs but commited #926918: Postgres compatibility

bverc’s picture

Yes it should be. Did you have trouble applying it?

andypost’s picture

@roborat I can't test your patch because have no PG installs right now

Please re-roll a patch against current d6-dev

Anyway I need another review to commit this patch

bverc’s picture

@andypost, it doesnt require postgres. It just assumes the pg patch was applied in advance, which should match the current dev version. Will re-roll to be sure though.

bverc’s picture

StatusFileSize
new4.71 KB

Here is the updated patch.
As its only in RC2, do you think it would be better to send the entire node through to the function?

Could you also have a look at the views stuff, as I'm not familiar with the views integration and can't figure out what would cause that error.

bverc’s picture

StatusFileSize
new4.71 KB

Ok, the patch wasn't applied to the dev version somehow, here is the real patch.

acbramley’s picture

Tested patch from #9 and works as expected.

andypost’s picture

Status: Needs work » Needs review

@roborat Thanx a lot for new patch! let's gather more reviews before commit. maybe someone could provide a views fixes

I'm trying to make a D7 port of current version for now so can't test this, glad see more reviews

bverc’s picture

StatusFileSize
new9.44 KB

Updated patch with views integration.

acbramley’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #12 was used and tested a long time ago by me in an internal project, I just forgot to update this issue. Works as expected.

andypost’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/nodereferrer.moduleundefined
@@ -453,8 +488,8 @@ function nodereferrer_nodereference_field_options() {
+    if ($type['type'] == 'nodereference' || $type['type'] == 'revisionreference') {

I see no definition of this type...

+++ b/views/nodereferrer_view_handler_relationship.incundefined
@@ -56,7 +56,12 @@ class nodereferrer_view_handler_relationship extends views_handler_relationship
+      if ($field['type'] == 'revisionreference') {

same

Powered by Dreditor.