Index: modules/taxonomy/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.372 diff -u -p -r1.372 taxonomy.module --- modules/taxonomy/taxonomy.module 30 Jul 2007 20:33:48 -0000 1.372 +++ modules/taxonomy/taxonomy.module 1 Aug 2007 01:04:17 -0000 @@ -377,10 +377,19 @@ function taxonomy_form_all($free_tags = * If set, return only those vocabularies associated with this node type. */ function taxonomy_get_vocabularies($type = NULL) { + static $vocabularies_cache = array(); + static $vocabularies_null; + if ($type) { + if (is_array($vocabularies_cache[$type])) { + return $vocabularies_cache[$type]; + } $result = db_query(db_rewrite_sql("SELECT v.vid, v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $type); } else { + if (is_array($vocabularies_null)) { + return $vocabularies_null; + } $result = db_query(db_rewrite_sql('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid ORDER BY v.weight, v.name', 'v', 'vid')); } @@ -393,7 +402,15 @@ function taxonomy_get_vocabularies($type $vocabularies[$voc->vid] = $voc; } + if ($type) { + $vocabularies_cache[$type] = $vocabularies; + } + else { + $vocabularies_null = $vocabularies; + } + return $vocabularies; + } /**