When I change the menu setting, Main Menu in my case, to include the links in the sitemap as default, menu links are still excluded.

When looking at an individual menu the drop down menu has the setting "Default (excluded)". I have tried to save the menu link, but with no changes.

This is with Drupal 7 RC3.

Comments

tsvenson’s picture

Priority: Normal » Critical

Did some more testing and it is not even possible to manually change an individual menu link to included. It is automatically reverted back to "Default (excluded)".

Upping priority to critical since module simply don't work at all with this bug.

dave reid’s picture

Priority: Critical » Major

That's not exactly the definition of a critical bug. Downgrading to major.

tsvenson’s picture

No problem, I thought it was to be seen as critical since the submodule in practice is completely broken as it is now.

dave reid’s picture

Confirmed the bug with altering XML sitemap settings for a menu. The menu link bug seems to as a result of #1013856: hook_menu_link_update() not invoked for menu links that have other elements form_alter()'d in.

dave reid’s picture

Status: Active » Fixed

Ok I think I worked around the core bug and double checked I could edit status and priority for both menus and menu links.
http://drupal.org/cvs?commit=473566

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

catch’s picture

Status: Closed (fixed) » Active
Issue tags: +Performance
StatusFileSize
new97.17 KB

Sorry to re-open this, but I tracked this commit down for a performance regression in menu_rebuild().

If you trigger a _menu_navigation_links_rebuild(), the array_intersect_assoc() in menu_link_save() prevents it from re-saving every menu link each time. Moving this to hook_menu_link_alter() from hook_menu_link_update() means that this code now runs whether the link is updated or not.

This took a menu_rebuild() on one Drupal 7 installation I'm profiling from less than one second to around six seconds.

Attaching webgrind screenshot to show the issue.

I'm wondering if it'd be possible to workaround the core bug by adding an extra #submit to the form alter rather than hook_menu_link_alter(), but it's late here so just posting the issue for now.

catch’s picture

Also cross linking #1034732: API additions: menu_link_load_multiple() and menu_link_delete_multiple() - looks like that would help here in general, although would be great to avoid it in the rebuild case entirely of course.

catch’s picture

Title: Menues still excluded after changing default to included » Menus still excluded after changing default to included
StatusFileSize
new658 bytes

This just adds checks to make sure we don't operate on links where module is system, that aren't customized. Fixes the 5 second regression for me.

I'm still seeing this run on hook_menu_link_insert(), if that turns out to be fixable in xmlsitemap will post a separate patch for that.

catch’s picture

Status: Active » Needs review
StatusFileSize
new659 bytes

No syntax error this time.

catch’s picture

StatusFileSize
new1.73 KB

Looked at this some more and discussed with Jacob Singh. Looking through the xmlsitemap_menu some more, it appears that even for module-defined links that aren't customized, this logic may still need to run (but only when an item is actually updated or inserted, not on every call to menu_link_save()).

A better workaround might be to add a #submit to the menu item form - that would then handle the updates not triggering, but without affecting menu_rebuild().

I noticed that on a menu_rebuild() that actually saved 53 links, this logic still took over 900ms, so would be good to optimize it independently - for example letting the process function take an array of links rather than just mlids, saving the menu_link_load().

For now I'm posting a revert, it looks like xmlsitemap_cron() may add these links eventually anyway.

dave reid’s picture

Status: Needs review » Needs work

The cron hook won't pick up links that have already been indexed. So this would cause a regression in the original bug.

katbailey’s picture

StatusFileSize
new1.75 KB

Pardon the noise but I needed a reroll of this patch for drush make purposes...

Anonymous’s picture

Status: Needs work » Needs review

Oh testbot here you go.

  • Dave Reid committed 9f881b3 on 8.x-1.x
    #1008566 by Dave Reid: Fixed bugs when altering XML sitemap settings for...
dave reid’s picture

Issue summary: View changes
Status: Needs review » Needs work

Issue in #12 has not been addressed yet.

lnunesbr’s picture

StatusFileSize
new1.79 KB

Updated patch to make it compatible with current 7.x-2.x-dev