diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-12-31 16:58:34 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-12-31 16:58:34 +0000 |
commit | 4157a521e0899622509022170c2be89da029c291 (patch) | |
tree | e1dc4051017fc0f211338f3646536bbd8b72ecdd /modules/taxonomy/taxonomy.module | |
parent | 6bb7647f0b42d1bd0ba5d3427433d9a1cc4ffda3 (diff) | |
download | brdo-4157a521e0899622509022170c2be89da029c291.tar.gz brdo-4157a521e0899622509022170c2be89da029c291.tar.bz2 |
#199373 report by avskip, patch by myself, testing by keith.smith: forum node type was not re-added to the forum vocabulary when the module is re-enabled (after being disabled)
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r-- | modules/taxonomy/taxonomy.module | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 3eb289820..c1bca9ff1 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -967,14 +967,18 @@ function taxonomy_get_term_by_name($name) { * @param $vid * The vocabulary's ID * - * @return Object - * The vocabulary object with all of its metadata. + * @return + * The vocabulary object with all of its metadata, if exists, NULL otherwise. * Results are statically cached. */ function taxonomy_vocabulary_load($vid) { static $vocabularies = array(); - if (!array_key_exists($vid, $vocabularies)) { + if (!isset($vocabularies[$vid])) { + // Initialize so if this vocabulary does not exist, we have + // that cached, and we will not try to load this later. + $vocabularies[$vid] = FALSE; + // Try to load the data and fill up the object. $result = db_query('SELECT v.*, n.type FROM {vocabulary} v LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE v.vid = %d', $vid); $node_types = array(); while ($voc = db_fetch_object($result)) { @@ -986,8 +990,9 @@ function taxonomy_vocabulary_load($vid) { $vocabularies[$vid] = $voc; } } - - return $vocabularies[$vid]; + + // Return NULL if this vocabulary does not exist. + return !empty($vocabularies[$vid]) ? $vocabularies[$vid] : NULL; } /** |