hello and thanks-
i am using drupal 4.6.1.

here's what happens-
if you click on administer/forums-
from a fresh install-

a new, forums vocab is created.

then from administer/forums-
you can create forums.

of course both the forums vocab-
and the forums (terms) are viewable
from administer/categories.

i stumbled upon this bug (?) while doing some testing...

it seems that if at any point you accidentally-
or on purpose- delete the forums vocab in categories-
the one that was auto-created by drupal-

you pretty much lose the ability to work with forums-
i think-

as i crawled the the database in phpmyadmin-

and it appears that once the first forums vocab
is auto-created-

forum_nav_vocabulary is set in variables.

but no matter what you do- either in the front end
thru the drupal admin (both thru categories AND forums admin)

and more importantly even if i muck around a bit and try
to change (or delete) the forums_nav_vocabulary
thru phpadmin- i can't get forums to come back online they way they should.

even if i wipe out all categories, terms, etc-
i can't get the forums to autocreate a default forums vocab.
and even knocking out the forums vocab nav setting in variables-
or changing it manually to the 'new' forums vocab ifd did not work.

of course i saw thru phpadmin that the vocab has a 'forum' setting
and i tried changing that too- no luck.

could someone please shed a little light on this issue- ?
i am very concerned that even thru the back-end- phpadmin-

i have looked at the 'before' and 'after' settings and data several times-

reverting back to a base (clean) drupal 4.6.1 database install-
and stepping thru carefully...

what is happening here-
and what is the fix- either manually thru phpadmin-
or thru drupal admin?

could someone please advise-
i am extremely concerned at how such a simple accident-
or even just an on-purpose delete of the first autocreated forums vocab-
would break the functionality needed to administrate the forums and forum module-
etc.

please advise and thanks- i am also concerned that something
very similar could happen on image module- the exact same way.

THANKS-
vincent

and i am co

Comments

robertdouglass’s picture

Good catch vincent, this is a bug. Here's what happens:

1) Forum vocabulary is created in forum.module, function _forum_get_vid(). This adds 3 pieces of data to the database, adding entries to the tables variable, vocabulary, and vocabulary_node_types.
2) The user visits the categories admin screen (or just clicks around the site for a while); another piece of data is added to the database in the form of cached variables from the variable table (forum_nav_vocabulary).
3) The user deletes the forum vocabulary via the admin/categories interface and 2 pieces of data are removed; the entries in vocabulary and vocabulary_node_types. Remaining are the entries in variable and cache.

The bug is that the variable forum_nav_vocabulary is outdated, a remnant from earlier times.

Code like this gets called 5 times in the forum.module:

$vid = variable_get('forum_nav_vocabulary', '');

Every instance should be replaced with a call to _forum_get_vid(). The function _forum_get_vid() needs to be rewritten so that it uses the following query to get the vid instead of variable_get. Since variables are cached statically to improve performance, these changes alone would result in degraded performance as we'd be querying the db every time we needed the forum vid. To fix this you can cache the vid statically in _forum_get_vid().

db_query("SELECT vid FROM {vocabulary_node_types} WHERE type = '%s'", 'forum');

Vincent, do you want to "roll a patch" for this?

robertdouglass’s picture

PS - you can see the cached variables in the cache table. Feel free to empty your cache table outright (truncate) as these values will be rebuilt as needed.

basicmagic.net’s picture

hi robert and thanks- glad i could finally give something back to drupal.

unfortunately i may not be the best candidate to roll a patch for this-
it would be my first patch and i'm not sure how to do that.
maybe you or someone else can jump in here for this one (patch).

also- what exactly has to be done to a database on a live install
to fix this, after the forum.module gets patched (if anything)-
to restore complete functionality?

please advise and thanks.

robertdouglass’s picture

Live database: clear cache table, erase the forum vocabulary variable entry from variable table. Then it should work (after the patch).

robertdouglass’s picture

Version: 4.6.1 » 4.6.0

Bumping to CVS since it affects 4.6.* and CVS

dalin’s picture

Version: 4.6.0 » 4.6.3

I still had this problem in 4.6.3. after delving into the variables table I have found this workaround:

-Create a new forum vocablulary, called forums, type:forum topic, Hierarchy: Disabled
-In the vocabulary table find the vid of the forum vocabulary
-In the variables table edit forum_nav_vocabulary to s:1:"x"; where x is the vid of the forum vocab.
-You may need to empty the cache table

This may make existing forum posts unreachble, but atleast the forum will be functional again.

killes@www.drop.org’s picture

Version: 4.6.3 » x.y.z

changing status to cvs.

nedjo’s picture

I'm thinking the best thing to do is exclude this vocabulary from taxonomy.module's interface, so have created a new issue, "Remove vocabulary and term handling from taxonomy module for vocabularies assigned to other modules", http://drupal.org/node/38221.

shane birley’s picture

This is still happening in 4.6.4 - is this correct?

Zen’s picture

Status: Active » Closed (duplicate)

Please use this thread to sort this issue out. This is an issue with the taxonomy module and the pros and cons seem to be more generically discussed in the other issue.

Marking this as a dupe, even though it isn't :P

Thanks for reporting this in basicmagic :)

Cheers
-K

oc’s picture

Dave's suggestion in #6, above, does not work in my case. I cannot create containers now that actually show up.

-rich

oc’s picture

I was able to get my forums back, I think. I ended up deleting all of the forums and containers from the admin interface because they didn't have any posts in them yet.

The procedure I followed, using phpmyadmin:

1) Create a vocabulary type called "forums" that has a single node type...
2) Reset the VID (vocabulary ID) for the forums entry in the vocabulary table to 1. Other boolean fields should all be zero for the row.
3) Edit the vocabulary_node_types table and change the entry that associated forum with the ID number you changed in step 2. In my case I had to change the number "17" back to 1; the correct value is probably 1
4) Go to admin/forum and Create a container and note the id number of the container you created
5) Fix the containers by resetting the value in the table "variables" and
name: forum_containers
value: a:1:{i:0;i:"insert-numeric-value-in-quotes";}

The stuff within the brackets includes weighting info for the containers. The 0 is thus a weight of zero.

After I did this my containers showed up again at www.site.org/forum

-rich

LAsan’s picture

Version: x.y.z » 7.x-dev

changing status to cvs.

JamesAn’s picture

Ooo.. a 4.6.1 issue survives to 7.x. Can someone verify if this bug still exists in either 6.x or 7.x?

dddave’s picture

As the one who brought this up again in #206820: Relocate or delete topics on forum deletion to avoid leaving stale data in database. because I had some kind of similar problem (solved http://drupal.org/node/509604) I tried to recreate this on my local instal. I failed...which is a good news.

I think this problem was solved by makeing the forums vocabulary indelible as long as the forum module is enabled. Disabling the module allows you to delete the vocab but reenabling recreates it automatically.

In my case above the problem was that for some reason the forum_nav_vocab entry in the variables table was not created on the first try. I had to try again and this created everything correctly. Any other hassles were due to i18n misconfigurations on my side.