function taxonomy_csv_term_find_duplicate in Taxonomy CSV import/export 6.5
Same name and namespace in other branches
- 6.2 taxonomy_csv.term.api.inc \taxonomy_csv_term_find_duplicate()
- 6.3 taxonomy_csv.term.api.inc \taxonomy_csv_term_find_duplicate()
- 6.4 taxonomy_csv.term.api.inc \taxonomy_csv_term_find_duplicate()
- 7.5 taxonomy_csv.term.api.inc \taxonomy_csv_term_find_duplicate()
- 7.4 taxonomy_csv.term.api.inc \taxonomy_csv_term_find_duplicate()
Find duplicate terms in a vocabulary or in all vocabularies.
Parameters
$vid: (Optional) Vocabulary to check in.
Return value
An array of term names, indexed by tid.
2 calls to taxonomy_csv_term_find_duplicate()
- _taxonomy_csv_export_result in export/
taxonomy_csv.export.result.inc - Display result messages of export process.
- _taxonomy_csv_vocabulary_export_process in export/
taxonomy_csv.export.api.inc - Batch process of vocabulary export.
File
- ./
taxonomy_csv.term.api.inc, line 227 - Find, get and set full or detail term items.
Code
function taxonomy_csv_term_find_duplicate($vid = 0) {
$terms = array();
$sql = '
SELECT t1.tid, t1.name
FROM {term_data} t1
LEFT OUTER JOIN {term_data} t2 ON t1.tid != t2.tid AND LOWER(t1.name) = LOWER(t2.name)
WHERE t2.tid IS NOT NULL
';
$args = array();
if ($vid) {
$sql .= ' AND t1.vid = %d AND t2.vid = %d ';
$args[] = $vid;
$args[] = $vid;
}
$sql .= ' ORDER BY t1.tid ASC ';
$result = db_query($sql, $args);
while ($term = db_fetch_object($result)) {
$terms[$term->tid] = $term->name;
}
return $terms;
}