In the Control Panel, there is a "Clean up databases" button. How does it work? What operations are carried out during a database cleanup?
2 Answers
In a Sitecore 8, this will:
- Cleanup CyclicDependences (items that couldn't be removed by CleanupOrphans because they have a parent but are not in the item tree)
- Cleanup InvalidLanguageData (remove all data from items in languages that are not defined as a valid language in the Sitecore system)
- Cleanup Fields (delete data from fields -SharedFields, UnversionedFields, VersionedFields- that have no related item anymore)
- Cleanup Orphans (delete items that have no parent anymore)
- Cleanup Blobs (delete blob fields that have no related field)
- Cleanup OrphanFields (clean the field data from the orphans removed in 4)
- RebuildDescendants
- Clear All Caches
Might be a few things less in older versions, although I don't think it has changed a lot.
-
-
Should be safe. But always take a backup before doing such operations. And I would not do it on the core database. Commented Feb 1 at 12:52
Typically, a cleanup operation will remove data in invalid languages and items in orphaned trees. That means:
all invalid language data (i.e. data for which the language does not exist) will be removed;
all field data for non-existing items will be removed;
orphaned items from the database will be removed;
all caches will be cleared.
Update : This code is triggered on last versions :
public override bool CleanupDatabase(CallContext context)
{
this.CleanupCyclicDependences();
this.CleanupInvalidLanguageData();
this.CleanupFields(context);
this.CleanupOrphans();
this.CleanupBlobs(context);
this.CleanupOrphanFields(context);
this.RebuildDescendants();
CacheManager.ClearAllCaches();
return true;
}