Fixing the assets table
From Joomla! Documentation
In 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 assets table should consist of:
The root should be in record 1 (ID=1) and have a parent_id of 0 and a level 0. 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 assets table.
Articles should have a level of no less than 3 but really they should be one greater than the category they are in. If you have an article with a level of less than 3 (0, 1, 2), you have a broken assets table.
If you have any articles or categories not in the assets table then you have a broken assets table.
Fixing the Assets
If you have determined that your assets table is not correct, you can take the following steps to repair it.
To follow this procedure, use the bulk processing widget at the bottom of the article manager page.
- 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, delete any trashed items. See the note below if you have trouble deleting.
- For each category, create an empty category called temp-categoryname.
- MOVE (do not copy) the articles for that category to the temp-categoryname category.
(Note that you can change the number of items to All in the pagination drop down so that you can do this in one big step.)
- 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 or 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 assets table).
Here's the trick, which works in Joomla 2.5.1:
- Create a temporary category for the trashed items.
- Edit each item (open the item) and move it to the new category.
- In the new category, change the state to published.
- Then trash and delete.