Posted by ralphb on December 7, 2010 at 8:10pm
15 followers
| Project: | Drupal core |
| Version: | 7.x-dev |
| Component: | menu system |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | closed (works as designed) |
Issue Summary
I've upgraded my 6.19 core system (without contrib modules) to 7.0rc1 without any database issues. In the new system, however, the menus are badly corrupted:
Navigation:
Add content (node/add)
Add content (node/add)
Add content (node/add)
Add content (node/add)
Add content (node/add)
Add content (node/add)
Benutzerliste (Deaktiviert) (profile)
Blog-Eintrag (node/add/blog)
Newsletter-Ausgabe (node/add/simplenews)
Pressebericht (node/add/bericht)
Seite (node/add/page)
Story (node/add/story)
Tipps zur Erstellung von Inhalten (Deaktiviert) (filter/tips)
Umfrage (node/add/poll)
Umfragen (Deaktiviert) (poll)
Veranstaltung (node/add/event)Management:
Statusbericht (admin/reports/status)
Verfügbare Aktualisierungen (admin/reports/updates)
...
Hilfe (admin/help)
Verwaltung (admin)
Verwaltung (admin)
Verwaltung (admin)
Verwaltung (admin)
Verwaltung (admin)
Verwaltung (admin)
Verwaltung (admin)In other words, top-level entries are showing up in duplicates, and sublevel entries are not grouped. Some top-level entries seem to be missing entirely. Navigating to admin yields the error message "no administration objects available".
I've flushed all caches using admin_menu, but to no avail. I also reset every menu entry using all admin/structure/menu/item/*/reset links that were offered by the system.
Comments
#1
ralphb: I had this problem as well on one site. However looking through the old D6 menu SQL tables revealed that they were also corrupted with duplicate entries.
#2
Can you dump the menu_links table and attach compressed?
#3
See related (non-critical) #865702: Broken admin pages/links after upgrade if "Administer" was not in the "Navigation" menu.
In that case, resetting the menus before upgrading fixed this.
I wonder if we should tell people they have to reset all menus before upgrading? Make a tool to do that?
#4
I wonder if we should tell people they have to reset all menus before upgrading?
That would be horribly unpopular with end users. If indeed the upgrade doesn't work, we just need to make it work.
#5
OK, but how would I reset the menus? As I said, I flushed the menu cache, and I clicked every "reset" link that was showing next a menu item. This made things worse.
bfroehle is right, though: My D6 menus are also corrupted in that I have some duplicate entries (which I simply "deactivated" so that they weren't showing up). Again, I don't know how to fix this -- these are menu items generated by modules, not custom content.
As for this ticket, does above make this a D6 issue or an upgrade issue? And more importantly, how can I fix my menus? Should I truncate table menu_cache like some articles on the web suggest? (If you still would like the table contents I can attach them later once I have shell access to the database.)
#6
ralphb: To resolve, I manually hacked the menu_links table in D6... very carefully. I don't know where the corruption came from --- it was present on a site I inherited. I do know that the site started on 6.x, so it wasn't a 5.x->6.x transition bug or anything like that.
#7
See: http://drupal.org/node/939050 the primary link and main menu don't integrate when upgrade from d6 to d7. This is error?
#8
Just a comment from the gallery - I know my menu table is corrupted as well. I usually don't discover it until well after whatever module I needed is installed and working and by then I have data and no idea how to replicate the error. I do not have time or confidence to hack the table, I just disable menus that don't work.
If there was a menu cleaning tool to run prior to attempting an upgrade, I'd run it, if only to get through an upgrade attempt. I can rebuild my menus if I have to.
#9
Yes we still need and badly your database dump.
#10
OK, here are the dumps of the D6 system right before the upgrade as well as the D7 system right after the upgrade and after resetting the menu items.
Please let me know if you require additional tables from me.
#11
@mrsinguyen in #7: That issue is different than what I experienced.
#12
Suggestion for moving forward (gonna try it myself; will post back here afterwards)
1. Try the upgrade and document the things that fail (a *lot* in my case...)
2. Dump your data, then edit the dump file to remove the menu tables (which are those?)
3. Create a new, blank Drupal-7 site and add the necessary modules.
4. Restore your data from the dump file.
#13
I am won't fixing this until a usable bug report appears. The bug report claims not using a contrib module then says "I've flushed all caches using admin_menu, but to no avail". Contradictory. Edit: also the menu_links table is full of contrib modules so I can't blame admin_menu alone but it's suspect at least.
Then comes " My D6 menus are also corrupted in that I have some duplicate entries (which I simply "deactivated" so that they weren't showing up)." I can see that they are corrupted, there four system module owned, customized (changed link_title) menu links pointing to 'admin'. I have no idea how could you get there. Here are the relevant pieces from
_menu_navigation_links_rebuild:<?php$existing_item = db_fetch_array(db_query("SELECT mlid, menu_name, plid, customized, has_children, updated FROM {menu_links} WHERE link_path = '%s' AND module = '%s'", $item['link_path'], 'system'));
// processing not touching customized
if (!$existing_item || !$existing_item['customized']) {
menu_link_save($item);
}
?>
and
+---------+--------+--------+------+------+------------+-----------+------------+------------+| updated | hidden | module | mlid | plid | menu_name | link_path | link_title | customized |
+---------+--------+--------+------+------+------------+-----------+------------+------------+
| 0 | 0 | system | 2 | 0 | navigation | admin | Verwalten | 1 |
| 0 | 1 | system | 26 | 0 | navigation | admin | Verwalten | 1 |
| 0 | 1 | system | 35 | 0 | navigation | admin | Verwalten | 1 |
| 0 | 1 | system | 47 | 0 | navigation | admin | Verwalten | 1 |
+---------+--------+--------+------+------+------------+-----------+------------+------------+
#14
chk, I meant that I upgraded my D6 system with all contrib modules disabled. And they were still disabled when I dumped the database (with the possible exception of admin_menu).
So should I open another ticket for the menu system on 6.x?
And the most important question is still unanswered: How can I fix this? Is there a way to rebuild the menu from scratch? Wouldn't it be a good idea if the upgrade would fix this on-the-fly?
I took the liberty of reopening this ticket, feel free to close it again but kindly provide some suggestion on how to proceed. Apparently I'm not the only one having issues with corrupted menus.
#15
The sentence "with the possible exception of admin_menu" is important here. The D6 version of Admin Menu does a lot of menu altering so that might be the cause of your problems. If you can show us that this problem is not related to admin_menu, then this is a critical issue for Drupal core. If not, I think this should be moved to the admin_menu project.
If I were you, I would completely disable and uninstall admin_menu in the D6 site and then attempt an upgrade again.
#16
Well, I had another look at the database. I'll try to recap:
Which is probably fine in hindsight. I guess I was expecting some functionality that would cause Drupal to reparse its modules' menu hooks to rebuild the menu from scratch. And some menu sanity checks probably wouldn't hurt, either.
I'll change the status of this ticket accordingly, hope that suits everybody.
#17
I don't agree. Have a look at the admin_menu_menu_alter function (http://drupalcontrib.org/api/function/admin_menu_menu_alter/6). Changing core menu items is its job.
#18
This is impossible to do. You have customized items, how any code is going to know they are unneeded?
#19
Just for the protocol:
It doesn't. As I said, the idea is to rebuild the menus from scratch. This would throw away all customized menus and menu items. Many users might prefer this approach to fiddling manually with their database in case of corruption.
#20
I can certainly live with #19.
#21
@ralphb: I think #19, the idea to rebuild menus from scratch, would be a good contributed module.
#22
OK, after a conversation with webchick, I'm going to call this major, but we have to have a specifically recreatable, testable path to cause the problem. We would really like this *not* to happen to people, but without a clear, understandable way to test it, it's never going to happen.
#23
I would like to assist in finding a way to test this... I am having one of my upgraded sites exhibit some sort of 'ghost in the system' problems with the entire menu system - menu options don't appear on node edit forms (they did in D6), menu items are being improperly reparented, and the toolbar module keeps losing all the management menu links (thus, it's empty except for the home and account links).
(Looking further into these issues, it looks like I additionally had to select an Available menu for each respective content type to have the menu options appear on that contenty type's edit forms... highly annoying—and a major pain in the rear for larger sites with 10+ content types).
#24
I'm willing to study a failed upgrade. It seems ralphb's #10 is invalid, as it was already messed up before the upgrade.
@geerlingguy, if you have a D6 database that I can use to demonstrate this, I will take a look at it.
However, if nobody has an integral D6 database that can be used to test this upgrade path, it will just end up getting closed again. We have to have real live testable situations.
#25
Rebuilding menu_links is completely out of question. Sorry, but you have no idea what are you talking of. menu_links have no code equivalent to rebuild from. Now, it is certainly possible after a backup to DELETE FROM menu_links WHERE module = 'system' and then rebuild the menu (which rebuilds the menu router and as a side effect regenerates the system links). However, core can't do that because you might have customized system links as well.
#26
Following chx's advice in #25, I simply did a:
mysql> DELETE FROM menu_links WHERE module = 'system'Then I rebuilt the menu by visiting www.example.com/devel/menu/reset (I have the Devel module enabled). Lo and behold, all menu troubles have vanished.
I discarded my D6 backup—stupid thing to do, but oh well...—and if I run into this problem again, I'll be sure to post the DB backup here to see where everything went wrong.
#27
@chx: Actually, all I suggested was that the menu_links table be discarded and then all entries be re-read from the core and non-core modules. Of course this will obliterate all custom menus and custom menu entries. If devel module is already doing the second part of this suggestion not only for system but also for other modules then, well, that's great, nothing to see here!
@rfay: Yes, there is no issue with the update itself. This is why I changed title and categorization of this ticket some time ago. I'll close it now, as no other users seem to have any issues.
#28
Just adding my voice to this conversation — I upgraded from Drupal 6.22 -> Dupal 7.4 and clicked "reset" on all of the menu items that had the link. I then found myself with duplicate menus (just like in the original post).
Most of the custom created menu links I added to the "Navigation" in D6 which linked to content types that no longer existed in D7 (I had deleted them after the upgrade), had "reset" next to them — which when clicked, turned them into generic "Add Content" links (non-deleteable) that pointed to node/add.
#26works.First backing up the DB, then Using phpMyAdmin, and the SQL Query string:
DELETE FROM `menu_links` WHERE `module` = "system"as outlined in#26, then rebuilding with the devel module, seems to have helped me as well.#29
Confirmed that #26 worked here too after an upgrade from D6 => D7.
#30
I can also confirm that #26 worked here after an upgrade from D6 => D7 and much hair-pulling. Thanks!
#31
To add to #28 : "Most of the custom created menu links I added to the "Navigation" in D6 which linked to content types that no longer existed in D7 (I had deleted them after the upgrade), had "reset" next to them — which when clicked, turned them into generic "Add Content" links (non-deleteable) that pointed to node/add."
This happens as well whit links to modules that where disable and uninstalled. Links where reset to there top parent on the menu creating many duplicates.
The menu items where simply not deleted on each unninstall of a module or deletion of a content type in D6. This is a D6 (D7) core bug ?
On my second D6->D7 upgrade, I deleted the duplicates in menu_links before going ->D7. Since I still have minor menu troubles, I will try #26.
Thx.
[Edit: #26 works]