In a custom module, if I add drupal_flush_all_caches() or menu_rebuild() in my module (for debugging purpose), the "CVS import" button in admin/content/taxonomy isn't displayed.

Even if I remove these calls, the button doesn't appear. The only solution is to desactivate and reactivate the module (without such calls).

Tested on drupal 6.2 & taxonomy_csv 6.x-1.5 with the files

csvbug.info

; $Id$
name = "csvbug" 
description = "Just to understand why CSV import button disapear" 
project = "csvbug" 
version = "6.x-1.0-dev"
core = 6.x
dependencies[] = taxonomy_csv

and csv.module :

<?php
// $Id$
/**
 * Debug level, int built like chmod for unix rights
 * 1 => menu_rebuild
 * 2 => drupal_rebuild_theme_registry
 * 4 => actions_synchronize
 * 8 => cache_clear_all
 * 16=> drupal_flush_all_caches
 */

// try 1 or 16 (or any number combined with 1 or 16) => CVS import button on admin/content/taxonomy isn't displayed
// (and doesn't appear anymore, even with DEBUG=0)

define('DEBUG', 2);

if (DEBUG && DEBUG % 2) {
  menu_rebuild();
  drupal_set_message('*** menu_rebuild ***');
  // module_invoke_all('menu'); // doesn't change anything
}
if (DEBUG && DEBUG % 4 > 1) {
  drupal_rebuild_theme_registry();
  drupal_set_message('*** drupal_rebuild_theme_registry ***');
}
if (DEBUG && DEBUG % 8 > 3) {
  actions_synchronize(FALSE, TRUE);
  drupal_set_message('*** Actions synchronised ***');
}
if (DEBUG && DEBUG % 16 > 7) {
  cache_clear_all();
  drupal_set_message('*** cache_clear_all ***');
}

if (DEBUG && DEBUG % 32 > 15) {
  drupal_flush_all_caches();
  drupal_set_message('*** All caches flushed ***');
}

Comments

decafdennis’s picture

Status: Active » Closed (won't fix)

First, this seems like an edge case, and second, I don't think it's specific to the taxonomy_csv module. The taxonomy_csv module defines the menu item correctly, and then it's up to Drupal to show it.

I think Drupal simply doesn't like it if you flush the caches or rebuild the menus halfway through the bootstrapping process. Anyway, if I click 'Empty cache' or 'Rebuild menus' in the devel menu, the 'CSV import' tab doesn't disappear.

dcaillibaud’s picture

OK, sorry for this "false bug" :-/

I'm using devel module but I haven't any "devel menu" ?
In devel.module file, I saw a lot of menu such as devel/cache/clear or devel/menu/reset and I realized then that I needed to activate these blocks...

thanks