read new menu link id (mlid) before new menu item is saved I'd like to do something with menu links when they are saved.

I can use hook_menu_link_alter():

function my_module_menu_link_alter($item) {
  my_module_do_something($item);
}


This seems like the best and only hook I can use here. Only, the my_module_do_something function requires $item to have the mlid propety (menu link ID) set, and when a new item is being saved, the property doesn't exist yet. 

I can fake it by querying the database for the most recent mlid value and incrementing 1:

$item['mlid'] = db_query('SELECT mlid FROM {menu_links} ORDER BY mlid DESC LIMIT 1')-&gt;fetchField() + 1;


(I'm not sure if I can use MAX() here, I don't know enough about dbs that aren't MySQL or Postgres)

And I think this will work fine for my specific use case, but I'm curious to know if there is a better, more generic solution. It seems to me that this one will break down if content is being imported rapidly while users are active on the site, for example. 

What is the best way to pass the future value of the item's mlid property to my function?
As Clive points out, the best way to do pass a menu link ID (mlid) when a menu item is created or updated is to use hook_menu_link_insert(), hook_menu_link_update() and hook_menu_link_delete() instead of hook_menu_link_alter().