Insert error in menu table of migrated data
From Joomla! Documentation
Revision as of 21:46, 13 August 2013 by Tom Hutchison
If your site has been migrated from J!1.5 earlier on, then you might experience problems when trying to update from 2.5.x to 3.1.5.
These instructions assume you have correctely prepped your joomla 2.5.11 install and are still having issues. (ie you have upgrade your extensions and removed those which are not compatable with j3.x etc...)
Due to the different variations of installed components, you might not see the exact error below but one very similiar.
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 j2.5.11 can be a difficult one if you arrived at j.25 via a migrated j1.5.x joomla install. the reason is that for some reason the jupgrade did not correctely migrate menu (or other possibly) id's correctely.
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 content starts until id 201. The user created menus or in this case the demo data start at 201. some versions of joomla possibly start this 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!