Insert error in menu table of migrated data
From Joomla! Documentation
If your site was migrated from Joomla! 1.5 to 2.5, you might experience problems when trying to update from your Joomla! 2.5.x to a 3.1.x version.
What is the cause
Menu id #'s are hard coded into the update. There might be an issue with updating because another menu item id # is using one of the hard coded id #'s.
How to fix
This will be a not be an issue in 3.2, see https://github.com/joomla/joomla-cms/pull/1722
These instructions assume you have upgraded to the latest Joomla! 2.5.x version and have upgraded your extensions and removed those which will not be compatible with Joomla! 3.1.x after your Joomla! 2.5.x upgrade.
Due to the different variations of installed components, you might not see the exact error below but one very similar.
0 - An error has occurred. SQL=INSERT INTO `jos_menu` (`id`, `menutype`, `title`, `alias`, `note`, `path`, `link`, `type`, `published`, `parent_id`, `level`, `component_id`, `checked_out`, `checked_out_time`, `browserNav`, `access`, `img`, `template_style_id`, `params`, `lft`, `rgt`, `home`, `language`, `client_id`) VALUES (23, 'main', 'com_tags', 'Tags', '', 'Tags', 'index.php?option=com_tags', 'component', 0, 1, 1, 29, 0, '0000-00-00 00:00:00', 0, 1, 'class:tags', 0, '', 45, 46, 0, '', 1);
The upgrade from Joomla! 2.5.x can be a difficult one if you arrived at Joomla! 2.5 via a migrated Joomla! 1.5.x installation. The error is for some reason the JUpgrade did not correctly migrate the menu table item id's correctly.
When you do a fresh install off Joomla 2.5.11 the menu items up to 200 are reserved for future Joomla menu updates for the core. No user created menus starts with an id 201. Some versions of Joomla possibly start user content at id 100.
Now in my case there is no gap between the core and the user data menu ids (ie i have some user menus in the 0 - 200 range) and this can rear its head when you do an upgrade because the guys at joomla expect 0-100 or 0- 200 to be empty so issues like the on i have do not happen and they can put their stuff in there.
one way of detecting this error without diving into the database is the lack of the joomla update component menu in the admin panel. You can correct this missing item by following this article -insert link-- but it will delete the menu item that is already there. If you know what you are doing just look in jos_menu and see if the range 0-200 only has joomla core stuff in it.
now my issue is when the update has almost finished it says there is a duplicate entry, in my case it is a jmedia menu item
It is the menu items that causes the upgrade issue for me.
later version of j2.5 made all new 'user content' menu items install in the jos_menu id 200+ region so this will never be an issue, but for those of use who have migrated from joomla 1.5 with jupgrade to an early version of j2.5 (early versions of jupgrade had issues in migrating menu id numbers), here is the fix
The errors in the database need fixing. But you can sucessfully upgrade to joomla 3.0.3 and then make the changes. I believe that it is after j3.0.3 the 'joomla extension' and 'joomla core' quick icon items are added. However i would make the changes to the j2.5.11 first. This note is really for reference for those on j3.0.3 having similiar issues and apart from the obvious the fix is still the same.
- backup, backup, backup etc..
- upgrade your joomla 2.5 to the latest version, should be 2.5.11 at the time of writing this
step 1 - copy all of you menu items (only those below 200)
- there is a batch copier at the bottom of the menu page
- move keeps the same id, only top level seems to get the number on the end)
- create a new menu for each of the affected menus (only those menus who holds menuitems with id<200). I just add a 'c' at the begining menu type and of the menu alias so no duplicates are created
- filter the menu to copy at the top
- make sure 'display all' is set
- select all the shown menu items
- go to the batch thing at the bottom (of menu items tab)
- select the new target menu, a blank one that begins in your 'c'- now copy the menuitems
- keeping 1 windows open with the list of menus, open the module manager and fiter by type, selecting menu
- edit each affected module (by editing the old menu module posistion just on the right of each menus entry) and swap from the old menu to the new 'c' menu
- once done check the new menus are working as they should
- if one of the affect menus is default, make sure to swap this aswell
- some of the menus items will get a 2 added on to them (to prevent duplicate alias). you will have to remove this manually
- delete the old menus from menu manager and make sure they are removed out of trash aswell
- now all the menus from below 200 should be removed
- in the databse you might have some menu items that were not deleted properely at some point in the past and should be removed via phpmyadmin (only if you know what you are doing)
- reassign all menu modules that have been affected to their new menu's (ie the ones with 'c' in front)
- delete the old menus (to avoid confusion)
- remove the letter 'c' from the beginning of the new module names (the menu and mosule will still be linked)
- rename the new modules to remove the word copy out of thier name etc..
- perform the joomla updater component fix
As mention before the joomla updater might be missing. To fix this you need to run the following sql script to add the entery back in. You by now should have an empty 0 - 200 menu id range. This is correcting one of those damaged enteries.
- additional missing menu items.
I checked the menu items on a fresh install of joomla 2.5.11 and discovered that core menu items go up to 22. (i think in later version of j3 tags is added in at id 23)
I had a missing item, Smart Search. here is the code i used to fix the missing item:
INSERT INTO `j25_menu` (`id`, `menutype`, `title`, `alias`, `note`, `path`, `link`, `type`, `published`, `parent_id`, `level`, `component_id`, `ordering`, `checked_out`, `checked_out_time`, `browserNav`, `access`, `img`, `template_style_id`, `params`, `lft`, `rgt`, `home`, `language`, `client_id`) VALUES (21, 'menu', 'com_finder', 'Smart Search', '', 'Smart Search', 'index.php?option=com_finder', 'component', 0, 1, 1, 27, 0, 0, '0000-00-00 00:00:00', 0, 0, 'class:finder', 0, '', 41, 42, 0, '*', 1);
the quickest way to get code like this is to use phpmyadmin to export them from a fresh copy of joomla j2.5.11
- now perform the upgrade to 3.1.1
- check database is correct and inspect your content
- file you j2.5.11 backup somewhere safe
- backup your new j3.1.1 site
- file you j3.1.1 backup somewhere safe
- click on the clear cache (i admin) link to allow the new admin menu to come properely
If the update icons are missing on the dashboard. this is because the plugins need to be enabled. on a default 3.0 install they are enabled by default.
Go to the plugin manager and enable:
- Quick Icon - Joomla! Update Notification
- Quick Icon - Joomla! Extensions Updates Notification
You possibly need to reinstall a component over the top if you get issues. i did, in particular k2. i had updated it to the latest version before upgrade (cannot uninstall it because it wipes the database)
Also if you have tried to update, and it failed, then you have to make shure that no tables from the update are left behind in the database, because they will also conflict!