In the hook_nodeapi, there is not check to see if the node exists in the 'uuid_automatic_for_nodes' variable. When doing a node_save programatically, it is generating UUIDs for things even when it shouldn't. To fix this wrap nodeapi like so:

<?php
function uuid_nodeapi(&$node, $op, $teaser, $page) {
$automatic_types = variable_get('uuid_automatic_for_nodes', array());

if ($automatic_types[$node->type]) {
switch ($op) {
// ...
}
}
}

We are checking to make sure the node->type exists in the automatic_types array before doing *anything*

Comments

phayes’s picture

Gah! The code didn't format correctly, let's try again:

function uuid_nodeapi(&$node, $op, $teaser, $page) {
  $automatic_types = variable_get('uuid_automatic_for_nodes', array());
  
  if ($automatic_types[$node->type]) {
    switch ($op) {
      // ...
    }
  }
}
skwashd’s picture

Thanks for the bug report. I went for a slightly different approach in commit fbfa077. This has been fixed and will be included in the next nightly build and official release.

skwashd’s picture

Status: Active » Fixed

Fixing status.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ryan_courtnage’s picture

Status: Closed (fixed) » Needs work

IMHO, the fix for this issue is incorrect (and it breaks my app, and probably others).

Isn't the addition of "Return early if we don't automatically generate UUIDs for this type" at odds with the code a little further down (line 42 of uuid.module)?

      // Handle the case where automatic UUID generation is turned OFF but a
      // node is created, node_save(), intentionally with the $node->uuid
      // attribute.
apotek’s picture

Title: hooke_nodeapi does not respect "Content types with automatic UUID generation" settings » hook_nodeapi does not respect "Content types with automatic UUID generation" settings
Issue summary: View changes

Fixed typo in the title to make the issue more findable on search.

skwashd’s picture

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

Drupal 6 core is no longer supported. We are no longer supporting 6.x-1.x versions of this module. I am closing this issue as won't fix.