Download & Extend

Call to undefined function taxonomy_get_vocabularies()

Project:Google Search Appliance
Version:6.x-2.0-beta1
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active

Issue Summary

A website I am building does not have the taxonomy.module enabled and it caused the below error. I know you are asking 'Who does not use the taxonomy module?' but this website is basically just brochure-ware.

Fatal error: Call to undefined function taxonomy_get_vocabularies() in /var/www/drubuntu.bigbluedrop.com/dev.mskcc.org/sites/all/modules/contrib/google_appliance/google_appliance.module on line 1147

Here is the current source code from google_appliance.module line 1147.

function theme_google_appliance_add_meta_tags($node) {
  // create list of tags to add
  $meta_data = array();

  // Adding taxonomy tags
  $vocabs = taxonomy_get_vocabularies();
  if (module_exists('nat') && $node->nat) { // Node Auto Term integration
    $node->taxonomy = array_merge($node->nat, $node->taxonomy);
  }
  if (!empty($node->taxonomy) && is_array($node->taxonomy)) {
    foreach ($node->taxonomy as $term) {
      $tagname = 'category-'. strtolower($vocabs[$term->vid]->name);
      $meta_data[] = array($tagname, $term->name);
    }
  }
  ...
}

The easy fix is to wrap the code with an " if (module_exists('taxonomy')) " statement.

function theme_google_appliance_add_meta_tags($node) {
  // create list of tags to add
  $meta_data = array();

  // Adding taxonomy tags
  if (module_exists('taxonomy')) {
    $vocabs = taxonomy_get_vocabularies();
    if (module_exists('nat') && $node->nat) { // Node Auto Term integration
      $node->taxonomy = array_merge($node->nat, $node->taxonomy);
    }
    if (!empty($node->taxonomy) && is_array($node->taxonomy)) {
      foreach ($node->taxonomy as $term) {
        $tagname = 'category-'. strtolower($vocabs[$term->vid]->name);
        $meta_data[] = array($tagname, $term->name);
      }
    }   
  }
  ...
}

Thanks,
~jake

Comments

#1

Priority:normal» critical

Or add taxonomy as a dependency in your the .info file. Either way would appreciate this bug being squashed in the next release. Should be considered critical as produces a Fatal Error.

#2

Any progress on this. This is very broken and it's been 2 months. It would be one thing if you had to do some steps to recreate this, but it's pretty simple, download and install a fresh D6 and enable this module. The code above works. Do you need a patch? Would you like to give me CVS access to commit it?

#3

This sounds like a trivial change which I'd love to commit. However I don't have access to a GSA anymore as I moved on to another project. Without access to a GSA I can't test the changes and without testing I won't commit!

So yes it would be great if you can sort out CVS access with JacobSingh.