Fixing the assets table
From Joomla! Documentation
Revision as of 17:39, 16 February 2012 by Elin
n Joomla 2.5 (and all releases since 1.6) there is a table #__assets that is largely invisible to users, but if the assets have improper values this can cause serious problems for your site. This document is going to give a little background to explain how to diagnose an assets problem and then one way to approach fixing it. This is most likely to happen as a result of a flawed migration from Joomla 1.5.
Unless you have installed extensions that track individual assets, your asset table should consist of:
The root should be in record 1 and have a parent_id of 0 and a level . It should be the only item with a parent_id of 0 and a level of 0.
Components should have parent_id of 1 (the root is their parent) and level of 1.
Categories can be nested, but your top level categories should have a parent_id that matches the asset_id of the component they are part of. They should have a level of 2.
Subcategories should have their parent categories as parents and have a level of 3,4,5 or whatever value makes sense for your category structure.
If you have a category with a level of less than 2 (0,1) then you have a broken asset table.
Articles should have a level of no less than 3 but really they should be one greater than the article they are in. If you have an article with a level of less than 3 (0,1,2) you have a broken asset table.
If you have any articles or categories not in the asset table then you have a broken asset table.
Fixing the assets
If you have determined that your asset table is not correct, you can take the following steps to repair.
- Go to a category tab and click on rebuild. This will rebuild the category assets and make sure that any sub categories are nested correctly.
- Look at your content and before doing anything else, check to see if you have any trashed items and delete them. See note below for if you have trouble deleting.
- For each category create an empty category called temp-categoryname.
- MOVE (not copy) the articles for that category to the temp-categoryname category.
- Do not delete the category.
- When you have moved all the articles, move them back to the proper category.
At this point your table should be correct unless you had other problems.
If you get a message that says you have duplicate aliases and therefore cannot copy it means just that, you have duplicate aliases. You will need to find them and make them unique. You can do this in your database of by trial and error.
If you have trashed items you cannot delete check to see if they have asset ids (that their value of asset_id in the content table is in the asset table).