Skip to content
Snippets Groups Projects
Commit 83e77b37 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#198461 by chx: use a simple subquery instead of iterating through all nodes...

#198461 by chx: use a simple subquery instead of iterating through all nodes and updating the term_node table one-by-one, which easily caused a timeout on sites with lots of term-node associations
parent 5d8cf1b8
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
...@@ -1628,11 +1628,7 @@ function system_update_6001() { ...@@ -1628,11 +1628,7 @@ function system_update_6001() {
db_add_primary_key($ret, 'term_node', array('vid', 'tid', 'nid')); db_add_primary_key($ret, 'term_node', array('vid', 'tid', 'nid'));
db_add_index($ret, 'term_node', 'vid', array('vid')); db_add_index($ret, 'term_node', 'vid', array('vid'));
// Update all entries with the current revision number. db_query('UPDATE {term_node} t SET vid = (SELECT vid FROM {node} n WHERE t.nid = n.nid)');
$nodes = db_query('SELECT nid, vid FROM {node}');
while ($node = db_fetch_object($nodes)) {
db_query('UPDATE {term_node} SET vid = %d WHERE nid = %d', $node->vid, $node->nid);
}
return $ret; return $ret;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment