Deleting terms freezes my installation of drupal, help with debugging techniques!

gnucifer - April 19, 2008 - 17:25

I just made the unpleasant discovery that deleting taxonomy terms make my installation of drupal go into an unresponsible state, and no redirection occurs from "Are you sure you want to delete the term". The just times out eventually. Checking the database the delete is successfull; for the first term. Deleting a vocabulary with several terms only the first will be deleted.

The part in taxonomy.module causing the hangup is:

<?php
function taxonomy_del_term($tid) {
 
$tids = array($tid);
  while (
$tids) {
   
$children_tids = $orphans = array();
    foreach (
$tids as $tid) {
     
// See if any of the term's children are about to be become orphans:
     
if ($children = taxonomy_get_children($tid)) {
        foreach (
$children as $child) {
         
// If the term has multiple parents, we don't delete it.
         
$parents = taxonomy_get_parents($child->tid);
          if (
count($parents) == 1) {
           
$orphans[] = $child->tid;
          }
        }
      }

     
$term = (array) taxonomy_get_term($tid);

     
db_query('DELETE FROM {term_data} WHERE tid = %d', $tid);
     
db_query('DELETE FROM {term_hierarchy} WHERE tid = %d', $tid);
     
db_query('DELETE FROM {term_relation} WHERE tid1 = %d OR tid2 = %d', $tid, $tid);
     
db_query('DELETE FROM {term_synonym} WHERE tid = %d', $tid);
     
db_query('DELETE FROM {term_node} WHERE tid = %d', $tid);

     
module_invoke_all('taxonomy', 'delete', 'term', $term);
    }

   
$tids = $orphans;
  }

 
cache_clear_all();

  return
SAVED_DELETED;
}
?>

Some contributed module should be the cause, and commenting out the hook_taxonomy invocation confirmes this.

egrep -rl 'hook_taxonomy' outputs:

./contrib/pathauto/pathauto.module
./contrib/taxonomy_access/taxonomy_access.module
./contrib/taxonomy_breadcrumb/taxonomy_breadcrumb.module
./contrib/taxonomy_dss/taxonomy_dss.module
./contrib/taxonomy_dss/taxonomy_dss_newcontent/taxonomy_dss_newcontent.module
./contrib/views/CHANGELOG.txt

I temporarily disabled all of these, but still the same thing. It would be great to step though the php with some kind of debugger, but I have no idea how to do this. Any ideas?

=-=

VM - April 19, 2008 - 17:30

would help to know eactly what version is in use including the minor number after the .

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

Sorry, drupal version 5.6

gnucifer - April 19, 2008 - 17:43

Sorry, drupal version 5.6 and taxomony access 5.x-1.1. But got it working again and not sure I really need taxomony access. Could try reinstalling just to check if it was something with the database or the module itself.

Actually, the problem with

gnucifer - April 19, 2008 - 17:56

Actually, the problem with Taxonomy Access Control persists even after reinstalling the module.

My mistake, I actually had

gnucifer - April 19, 2008 - 17:38

My mistake, I actually had forgotten to disable taxonomy access. Now it works again :) Strange though, but I might have messed up the database somewhat, so its very likely taxonomy access is not (directly) to blame for this.

 
 

Drupal is a registered trademark of Dries Buytaert.