Skip to content
Snippets Groups Projects
Commit a1cbd755 authored by Angie Byron's avatar Angie Byron
Browse files

#930708 by catch, dww: Fixed taxonomy_update_7005() can go on an infinite search.

parent 522c052f
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -13265,6 +13265,11 @@
'vid',
'tid',
))
->values(array(
'nid' => '1',
'vid' => '1',
'tid' => '0',
))
->values(array(
'nid' => '1',
'vid' => '1',
......
......@@ -117,6 +117,13 @@ class UpgradePathTaxonomyTestCase extends UpgradePathTestCase {
}
}
// nid 1, revision 1 had a bogus record in {term_node} pointing to term
// ID 0. Make sure we ignored this instead of generating a bogus term.
if ($node->nid == 1) {
$link = l($term->name, 'taxonomy/term/0');
$this->assertNoRaw($link, t('Bogus term (tid 0) is not displayed on node 1 vid %old_vid.', $args));
}
// The first 12 nodes have two revisions. For nodes with
// revisions, check that the oldest revision is associated only
// to terms whose ID is equal to the node ID or 49 less the node ID.
......
......@@ -566,8 +566,11 @@ function taxonomy_update_7005(&$sandbox) {
$sandbox['last'] = 0;
$sandbox['count'] = 0;
$query = db_select('taxonomy_term_node', 't');
$sandbox['total'] = $query->countQuery()->execute()->fetchField();
// Run the same joins as the query that is used later to retrieve the
// term_node data, this ensures that bad records in that table - for
// tids which aren't in taxonomy_term_data or nids which aren't in {node}
// are not included in the count.
$sandbox['total'] = db_query('SELECT COUNT(*) FROM {taxonomy_term_data} td INNER JOIN {taxonomy_term_node} tn ON td.tid = tn.tid INNER JOIN {node} n ON tn.nid = n.nid LEFT JOIN {node} n2 ON tn.vid = n2.vid')->fetchField();
// Use an inline version of Drupal 6 taxonomy_get_vocabularies() here since
// we can no longer rely on $vocabulary->nodes from the API function.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment