Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The following error appears when attempting a fresh install of Drupal 6.9 with the category module placed in /sites/all/modules/
[Sun Feb 01 14:52:50 2009] [error] [client ****] PHP Fatal error: Cannot redeclare taxonomy_schema() (previously declared in /****/sites/all/modules/category/wrappers/taxonomy/taxonomy.install:9) in /****/modules/taxonomy/taxonomy.install on line 285
Install proceeds correctly with category module directory removed.
Comments
Comment #1
higherform CreditAttribution: higherform commentedI realized the problem as soon as I took a break... category module was under /sites/all/modules/ instead of /modules/.
Consider adding a warning message if category is installed to the wrong directory?!?
Comment #2
EastWan CreditAttribution: EastWan commentedSame problem here. It would be *really* helpful to add a warning message or at least make it clearer in the INSTALL.txt because you always read "Step 1 - put the module in sites/all/modules" and so you kind of skip this. Adding a "Warning: Do not put in the sites/*/module folder" would certainly help a lot of people!
Thanks!
Comment #3
EastWan CreditAttribution: EastWan commentedWell, I thought it worked this way. But it doesn't. I used a fresh install, so category wrappers were not installed.
But once you have one site running and install the wrappers (so they are read as .install and not .install.php) and then go to install another site, you get the before mentioned error.
This only seems to happen when adding a new site. I'm not familiar whether there is a way to prevent Drupal from accessing taxonomy_schema() in the taxonomy file (since the wrapper does all the work, it seems sort of useless loading that file). I feel a bit uncomfortable messing with the core taxonomy.install file (adding a if(!function_exists) could help for instance, or having the script rename the core taxonomy.install to taxonomy.install.php) - but clearly, there must be a better way?
Comment #4
EastWan CreditAttribution: EastWan commentedOkay, there's more problems coming up. I used function_exists() to only include the core taxonomy.module's taxonomy_schema when category isn't there.
Simply wrap the function
taxonomy_schema()
in module/taxonomy/taxonomy.install with:So far, so good. But this results in calls to category specific functions (
like category_link()
), although you are not using category on that subsite.So, basically, this module breaks your entire Drupal site when you have Category including its taxonomy wrapper activated on another site but not on that particular site. (That is, the category/wrappers directory includes taxonomy.module instead of taxonomy.module.php).
The solution that worked for me was to check whether category is activated and include the original taxonomy.module if this is not the case.
In modules/category/wrappers/taxonomy.module wrap all the functions in this file with:
This module should really not be so convinced of itself to think that it will always be enabled, thereby not causing these problems ;-).