0

Is there a way to call menu_rebuild so it will only update items in selected module and / or hook_menu ?

I need it to update links ( if they are already existing ) and add new ( if they are now ).

Don't want the menu_rebuild to clear the menu_router.

1 Answer 1

2

I am afraid that's what the function does. From Drupal docs:

This function will clear and populate the {menu_router} table, add entries to {menu_links} for new router items, and then remove stale items from {menu_links}. If called from update.php or install.php, it will also schedule a call to itself on the first real page load from menu_execute_active_handler(), because the maintenance page environment is different and leaves stale data in the menu tables.

I guess you could try to reimplement the function into your own custom one and modify its source according to your needs. It looks like a lot of work though. You'd probably have to reimplement more functions.

Source: https://api.drupal.org/api/drupal/includes!menu.inc/function/menu_rebuild/7

3
  • Yes. I thought of that... Jun 19, 2015 at 9:08
  • 2
    The function does what it does @MichałPrzybyłowicz, you can always implement your own and call that instead, but the core function is all or nothing unfortunately
    – Clive
    Jun 19, 2015 at 9:11
  • @MichałPrzybyłowicz To add to Clive's comment - core function is opensource, so it should be pretty easy to copy it and change :)
    – Mołot
    Jun 19, 2015 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.