While the refresh module code seem to use the revisions system (storing the refresh value indexed by both node number and revision number), but creating a new revision does not seem to create a new record for the new revision.

Either the refresh information should be stored indexed by only the node number, or more work should be done to fully support revisions.

I've tried to do this, by changing the code for deleting a node to delete meta-data for all revisions, and adding a new action for deleting only a revision.

      case 'delete':
        $result = db_query("DELETE FROM {node_refresh} WHERE nid = %d", $node->nid);
        break;

      case 'delete revision':
        $result = db_query("DELETE FROM {node_refresh} WHERE nid = %d AND vid = %d", $node->nid, $node->vid);
        break;

But I'm still having trouble in creating a new record in the "node_refresh" table when a new revision is created.

I'm very new to Drupal development, and I'm not sure where to add such code, and it seems that the 'insert' operation of hook_nodeapi is not triggered for creation of new revisions.

Anybody has a clue?

Comments

redeemer’s picture

Status: Active » Needs review

After some digging I came up with this:

      case 'update':
	if ($node->revision) {
		$result = db_query("INSERT INTO {node_refresh} (nid, vid, seconds) VALUES (%d, %d, %d)", $node->nid, $node->vid, (int) $node->refresh);
	} else {
		$result = db_query("UPDATE {node_refresh} SET seconds = %d WHERE nid = %d AND vid = %d", (int) $node->refresh, $node->nid, $node->vid);
	}
        break;

I'm not sure if this is the best way to do this, but it seems to work.

What is being done is that, if a new revision is being created, a new record will be inserted into "node_refresh", else, the old record will be updated.

mo6’s picture

Status: Needs review » Postponed (maintainer needs more info)

Which version are you using? The D4.7 and D5 versions of the module are not supported anymore.

DuaelFr’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

This version of Refresh is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.

This issue has been automagically closed by a script.