@@ -452,31 +452,9 @@ function taxonomy_form_all($free_tags = 0) {
* @param $type
* If set, return only those vocabularies associated with this node type.
*/
functiontaxonomy_get_vocabularies($type=NULL){
if($type){
$result=db_query(db_rewrite_sql("SELECT v.vid, v.*, n.type FROM {taxonomy_vocabulary} v LEFT JOIN {taxonomy_vocabulary_node_type} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name",'v','vid'),$type);
}
else{
$result=db_query(db_rewrite_sql('SELECT v.*, n.type FROM {taxonomy_vocabulary} v LEFT JOIN {taxonomy_vocabulary_node_type} n ON v.vid = n.vid ORDER BY v.weight, v.name','v','vid'));
}
$vocabularies=array();
$node_types=array();
while($voc=db_fetch_object($result)){
// If no node types are associated with a vocabulary, the LEFT JOIN will
// If only conditions is passed, load all items from the cache. Items
// which don't match conditions will be removed later.
elseif($conditions){
$vocabularies=$vocabulary_cache;
}
}
if(empty($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 {taxonomy_vocabulary} v LEFT JOIN {taxonomy_vocabulary_node_type} n ON v.vid = n.vid WHERE v.vid = %d',$vid);
// Remove any loaded terms from the array if they don't match $conditions.
$this->assertEqual(array_shift($vocabularies),$vocabulary3,t('Vocabulary loaded successfully by ID.'));
$this->assertEqual(array_shift($vocabularies),$vocabulary2,t('Vocabulary loaded successfully by ID.'));
$this->assertEqual(array_shift($vocabularies),$vocabulary1,t('Vocabulary loaded successfully by ID.'));
// Fetch vocabulary 1 by name.
$this->assertTrue(current(taxonomy_vocabulary_load_multiple(array(),array('name'=>$vocabulary1->name)))==$vocabulary1,t('Vocabulary loaded successfully by name.'));
// Fetch vocabulary 1 by name and ID.
$this->assertTrue(current(taxonomy_vocabulary_load_multiple(array($vocabulary1->vid),array('name'=>$vocabulary1->name)))==$vocabulary1,t('Vocabulary loaded successfully by name and ID.'));