When I enable a new menu in Drupal (for example, mymodule), Drupal should be able to get the menu items from mymodule_menu (hook_menu), process the items and insert the menu items to menu_router and menu_links table.
However, my Drupal fails to do so (it worked well before, according to the previous developer). Each time I enable a module (written by me or modules contributed by others, or core modules), Drupal does not seem to get the new information. The menu items defined in the newly enabled module are not processed and inserted to Drupal's menu system. That means the newly enabled module has no chance to work-- because it's inaccessible.
I did fix this by manually insert the menu item information for the new module into the menu_router and menu_links table and the new menu started working. But this is a nightmare if I have to do this each time I enable a module.
Any one has ever had the same problem? How to fix this?
Thank you in advance.
Comments
.
This happens very often to people trying to run update.php or to enable one more module, when menu_rebuild() fails to complete.
It is a pretty heavy function, in memory requirements and time. Check PHP memory_limit and also PHP and MySQL timeout settings.
Same problem. I have
Same problem. I have "memory_limit = 256M" in php.ini and
key_buffer = 32Mmax_allowed_packet = 32M
thread_stack = 256K
thread_cache_size = 16
query_cache_limit = 2M
query_cache_size = 32M
in my.cnf - no effect.
Anyway, if that function fails - why there is no error handling and reporting? How could I know that it fails and why?
Put this function in your
Put this function in your module, it will clear the cache then rebuild the menu_router table
function mymodule_init() {
cache_clear_all();
menu_router_build();
}
it worked for me.