The current node_export_features integration aborts creation of the node options list if more than 20 nodes do not have UUIDs. This behaviour is undesirable on some sites. The UUID module has a feature which allows only certain content types to receive UUIDs (I'm not sure why, but they do..). When this functionality is enabled, in UUID, it is possible that all Page nodes get a UUID but all Blog nodes do NOT get a UUID, and this is totally correct behaviour.

This patch removes the auto UUID creation functionality and instead directs the user to go fix the settings in their UUID configuration in the case where a node is missing a UUID.

Patch to be attached shortly..

Comments

James Andres’s picture

James Andres’s picture

Forgot to mention, Daniel I know you're busy, if you think this looks OK I'll go ahead and commit it. Would be good to have someone verify this.

danielb’s picture

Yeah that was a weird thing I did, but only really works if you have a few nodes. While you have your head in this, can we do something similar in Drupal 7? Not sure if the same method is used there.

Also I'd prefer to do something like this with the formatting of the message

<?php
        drupal_set_message(
          t('Some nodes are <strong>not</strong> available for export' .
            ' because of missing UUIDs. Ensure UUIDs are being generated for' .
            ' all content types and click the <em>Create missing UUIDs</em>' .
            ' button on the <a href="!url">UUID settings page</a> to help' .
            ' resolve this issue.', 
            array('!url' => url('admin/settings/uuid'))
          ), 
          'warning'
        );
?>

It still looks awkward, it's just that I'm worried the whitespaces within the string could show in translation interfaces - though I really have no idea if they would. I know the escaping backslashes will, so I changed that.

danielb’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Needs review » Patch (to be ported)

I've committed the patch and changed the message like in #3.
http://drupalcode.org/project/node_export.git/commit/7364f21
Still need to look at D7 though.

danielb’s picture

7.x done

I'm also going to remove the $msg_printed variable from both versions. drupal_set_message() has a parameter that prevents duplicate messages being printed.

danielb’s picture

Status: Patch (to be ported) » Fixed

I guess that's it. If you want to revisit it, go ahead and reopen.

James Andres’s picture

Thanks Daniel. Sorry for going dark there, I was on holiday last week. Much appreciated.

Status: Fixed » Closed (fixed)

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

fxarte’s picture

Hi there,
This may only affect in my case, which is, using drush features component command and selecting any particular components class, it produces this message for all the nodes without UUID, a really long list, which is really undesirable.
As some times you just need to export a very small subset of nodes, I added an extra check for a variable: node_export_features_generate_messages which we could set/unset whenever we need this messages to show up or not.

I just wanted to run the idea in this thread as there may be a better solution for this situation:

::
 // Skip nodes that have no UUID
    if (empty($uuid) && variable_get('node_export_features_generate_messages', FALSE)) {
      drupal_set_message(
::
joelpittet’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Issue summary: View changes
Status: Closed (fixed) » Active
Issue tags: +needs backport to 6.x-3.x

This looks like it would be the trick but needs to be ported back to 6.x.

joelpittet’s picture

Hmm maybe I'm wrong, I just see all nodes spitting that warning message and thought this was the cure but it may have been the cause.

Some nodes aren't generating UUID (on purpose) and I think it's still throwing errors for them, thousands of them!

rogerb’s picture

I think this issue is being over-thought. As Joel says above, some nodes have UUIDs and other don't. Only nodes with UUIDS are candidates for export, so only those nodes should be listed.

/**
 * Implementation of hook_features_export_options().
 */
function node_export_features_features_export_options() {
  $options = array();

  $types = node_get_types('names');
  $result = db_query("SELECT un.uuid, n.title, n.type FROM {uuid_node} AS un, {node} AS n WHERE un.nid = n.nid ORDER BY n.type, n.title ASC");

  while ($row = db_fetch_object($result)) {
    $options[$row->uuid] = t('@type: @title', array(
      '@type' => $types[$row->type],
      '@title' => $row->title,
    ));
  }

  return $options;
}
danielb’s picture

Status: Active » Closed (outdated)