Actions

Difference between revisions of "Fixing the assets table"

From Joomla! Documentation

(Troubleshooting)
(One intermediate revision by one user not shown)
Line 17: Line 17:
 
If you have a category with a level of less than 2 (0,1) then you have a broken asset table.
 
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.
+
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 asset table.
  
  
Line 42: Line 42:
 
==Troubleshooting==
 
==Troubleshooting==
  
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 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 asset table).
 
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).

Revision as of 01:58, 17 February 2012

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 asset table should consist of:

  • root
  • components
  • categories
  • articles

The root should be in record 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 asset 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 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.

To follow this procedure you will want to 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, 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.

(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.

Troubleshooting

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 asset 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.