Fixing the assets table
From Joomla! Documentation
As of Joomla 1.6 there is an #__assets table that might have improper values. This can cause serious problems for your site. This document will explain how to diagnose an assets problem and a way to fix it.
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 lower than 2 (0,1), you have a broken assets table.
Articles should have a level of no lower than 3 but really they should be one greater than the category they are in. If you have an article with a level lower than 3 (0, 1, 2), you have a broken assets table.
If you have any articles or categories not in the assets table, you have a broken assets table.
Fixing the Assets
If you have determined that your assets table is not correct, 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 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, you 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).
- 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.