I have only noticed this with webform nodes, and not every time I export one. Certain webform nodes when exported will have a vid field that is equal to the vid in the source export array.

This causes the node to be wholely in the database. But it causes the node_load function to return false which produces a 404 when you try to view or edit the node.

For instance the vid on my dev system is 11599. It gets export to my staging system and a new vid is created, we'll say 15221. Instead of the vid column in the node table being set to 15221 it is set to the vid of 11599 which does not exist on my staging system. Resulting in the node_load function returning false.

This query will repair the node which is my current workaround.

UPDATE node n
LEFT JOIN node_revisions r ON r.vid = n.vid
LEFT JOIN node_revisions cr ON cr.nid = n.nid
SET n.vid = cr.vid
WHERE r.vid IS NULL;

My current relevant stack is:

  • Webform 6.x-3.18
  • Universally Unique IDentifier 6.x-1.0-rc2
  • Node export 6.x-3.4
  • Revisioning 6.x-3.15

Comments

Hello,

I've experienced the same problem, in my case the vid changes due to this node_save()

function node_export_relation_node_reference_update($nodes) {
  foreach ($nodes as $node) {
    $uuid[$node->uuid] = $node->nid;
  }
  foreach ($nodes as $node) {
    $node_reference_fields = node_export_relation_node_reference_fields($node->type);
    if (!empty($node_reference_fields)) {
      foreach ($node_reference_fields as $node_reference_field) {
        if (!empty($node->$node_reference_field)) {
          foreach ($node->$node_reference_field as $key => $node_reference) {
            if (!empty($node_reference['nid'])) {
              $node_uuid = node_export_relation_node_reference_map($node_reference['nid']);
              $node->{$node_reference_field}[$key] = array('nid' => $uuid[$node_uuid]);
            }
          }
        }
      }
    }
    node_save($node);
  }
}

Replacing "node_save" by "drupal_write_record('node', $node, 'nid');" fixes the problem for me.

Sorry I was wrong, in my case the culprit was the module "revisioning" which was resettings the vid column in the node table when nodeapi op = update