--- wikitools.admin.inc.orig 2009-09-14 07:50:00.000000000 -0700 +++ wikitools.admin.inc 2009-09-14 07:50:19.000000000 -0700 @@ -151,18 +151,18 @@ function _wikitools_duplicate_nodes_quer $n1_title = 'n1.title'; $n2_title = 'n2.title'; if (wikitools_treat_underscore_as_space()) { - $n1_title = 'REPLACE('. $n1_title .', "_", " ")'; - $n2_title = 'REPLACE('. $n2_title .', "_", " ")'; + $n1_title = "REPLACE($n1_title, '_', ' ')"; + $n2_title = "REPLACE($n2_title, '_', ' ')"; } if (wikitools_treat_dash_as_space()) { - $n1_title = 'REPLACE('. $n1_title .', "-", " ")'; - $n2_title = 'REPLACE('. $n2_title .', "-", " ")'; + $n1_title = "REPLACE($n1_title, '-', ' ')"; + $n2_title = "REPLACE($n2_title, '-', ' ')"; } // Grab all nodes that have the same title $node_types_placeholders = db_placeholders($node_types, 'varchar'); $from_part = 'FROM {node} n1, {node} n2 WHERE LOWER('. $n1_title .') = LOWER('. $n2_title .') AND n1.nid != n2.nid AND n1.type IN('. $node_types_placeholders .') AND n2.type IN('. $node_types_placeholders .')'; - $select_query = 'SELECT DISTINCT(n1.nid) ' . $from_part . ' ORDER BY n1.title ASC'; + $select_query = 'SELECT DISTINCT(n1.nid), n1.title ' . $from_part . ' ORDER BY n1.title ASC'; $count_query = 'SELECT COUNT(DISTINCT(n1.nid)) ' . $from_part; return array($select_query, $count_query, array_merge($node_types, $node_types)); }