Package: collective.catalogcleanup
ContentsDocumentationUsage and goalDetailsAlternativesCompatibilityAuthorsChangelog2.0.0 (2023-11-30)1.11.2 (2021-08-24)1.11.1 (2021-08-13)1.11.0 (2021-07-29)1.10.0 (2020-02-08)1.9.0 (2018-09-25)1.8.0 (2018-04-30)1.7.2 (2017-09-18)1.7.1 (2017-03-07)1.7 (2017-03-03)1.6 (2016-08-23)1.5 (2015-07-31)1.4 (2014-05-12)1.3 (2013-09-02)1.2 (2012-06-04)1.1 (2012-05-14)1.0 (2012-04-27)DocumentationUsage and goalAddcollective.catalogcleanupto the eggs in your buildout.
This makes a browser view available on the Plone Site root:@@collective-catalogcleanup.This goes through theportal_catalogand removes all catalog brains for which agetObjectcall does not work.
In other words, it removes brains that no longer belong to an actual object in the site.The goal is to get rid of outdated brains that could otherwise cause problems, for example during an upgrade to a new major Plone version.@@collective-catalogcleanupby default does a dry run, so it only reports problems.
Call it with@@collective-catalogcleanup?dry_run=falseto perform the actual cleanup.DetailsSo what does the catalog cleanup do?It removes stuff!  Youmustmake a backup first!It handles theportal_catalog.
Version 1.x also handleduid_catalogandreference_catalog.For each catalog it reports the number of catalog brains it contains.It removes brains that have a UID ofNone.It removes brains of which the object is broken.  This can happen
when the object belongs to a package that is no longer available in
the Plone Site.It removes brains of which the object cannot be found.It looks for non unique uids.
We accept one object and we give the other objects a new UID.A simple report will be printed in the browser.
It may look like this:Brains in portal_catalog: 20148
portal_catalog: removed 25 brains without UID.
portal_catalog: removed 100 brains with status broken.
portal_catalog: removed 5 brains with status notfound.
portal_catalog: 249 non unique uids found.
portal_catalog: 249 items given new unique uids.The instance log may contain more info, about individual items.AlternativesA clear and rebuild of theportal_catalogshould have partially the
same effect, but it will likely take a lot longer and it will not
solve some of the problems mentioned above.  But this is definitely
the most logical thing to try before givingcollective.catalogcleanupa go.CompatibilityVersion 2.x works on Plone 5.2 and 6.0, on Python 3 only.
For earlier Plone and Python versions, use version 1.x.AuthorsMaurits van ReesChangelog2.0.0 (2023-11-30)No longer accept non-unique inherited UIDs.
This was needed for Discussion Items, but not anymore.
[maurits]Fixed setting new uuids for Dexterity content and Discussion Items.
This part of version 1.x seems to only have worked for Archetypes.
[maurits]Removed support for checking thereference_cataloganduid_catalog.
These are Archetypes-only.
[maurits]Drop support for Python 2, Plone 5.1 and earlier.
Only Plone 5.2 and 6 are supported, on Python 3.
[maurits]1.11.2 (2021-08-24)Do not complain about paths being different when the brain path is relative.
Happens in old uid_catalog and reference_catalog.
[maurits]1.11.1 (2021-08-13)Again fixed error sorting UIDs when one of them is None.  [maurits]1.11.0 (2021-07-29)Report and remove brains that have a wrong path.
These are brains where an object is found at the given path,
but the actual path of this object is different.
This can be caused by acquisition:
/Plone/folder/folder has gotten in the catalog,
but really only /Plone/folder exists.
[maurits]Fixed error sorting UIDs when one of them is None.  [maurits]1.10.0 (2020-02-08)To get all brains, usecatalog.getAllBrainswhen available.
This is available inProducts.ZCatalog2.13.30+ or 4.1+.
We fall back tounrestrictedSearchResultsand otherwise just call the catalog.
Fixesissue 16.
[maurits]Bug 22:
Fix startup error when Archetypes is missing.
Fix other Plone 5.2 and Python 3 errors.
Should be compatible with Plone 4.3, 5.1 and 5.2 now.  [maurits]1.9.0 (2018-09-25)Catch TypeError when getting object for brain.
Can happen when an object that used to be referenceable is no longer referenceable.
Fixesissue #19.
[maurits]Disable CSRF protection.
Fixesissue #17.
[maurits]Abort any transaction changes in dry run mode.
There should not be any changes here anyway, but this makes sure.
[maurits]1.8.0 (2018-04-30)No longer test on Plone 4.1 and 4.2 and on Python 2.6.  [maurits]CatchKeyErrorandAttributeErrorforgetPathin more cases.
Fixesissue #14.
[maurits]1.7.2 (2017-09-18)Added traceback info to help in case of problems.  [maurits]1.7.1 (2017-03-07)Tested for compatibility on Plone 4.0 through 5.1.  [hvelarde]Ignore non existing catalogs.  Plone 5 does not always have
auid_catalogorreference_catalog.
Fixesissue #5.
[maurits]1.7 (2017-03-03)Don’t look for non unique ids in thereference_catalog.
It looks like it is normal there.  At least, on one Plone 4.3 site
the code keeps creating several new uids every time I run it.
[maurits]Don’t complain about brains inreference_catalogwheregetObjectreturns None.
This happens for content without apparent problems.  [maurits]1.6 (2016-08-23)Do not complain about brains in uid_catalog that are references.
When their path points to...at_references/<uidof brain>then
this is normal.  I started wondering about a site that had more than
20 thousand problems reported this way.  [maurits]1.5 (2015-07-31)Remove all items that have theportal_factoryfolder in their
path.
[maurits]1.4 (2014-05-12)Catch KeyErrors when getting the path of a brain.
[maurits]1.3 (2013-09-02)Give less confusing message for comments that inherit the UID of
their parent.  It sounded too much like an error.
[maurits]1.2 (2012-06-04)Improved the cleanup of non unique uids.
[maurits]1.1 (2012-05-14)When doing an reindexObject, only reindex the UID.
[maurits]1.0 (2012-04-27)Initial release
[maurits]