[Zope-dev] find unused objects: hopefully the last misunderstanding...

Jean Jordaan jean@upfrontsystems.co.za
Fri, 30 Aug 2002 14:14:44 +0200


THerp@apriori.de wrote:
> I have lots of scripts, dtml methods etc. everywhere which are
> perfectly well-known to the ZODB, nothing wrong with that, but which
> are simply not used by me anymore. No usage from other scripts nor
> methods nor documents. And these buggers I'd like to find.

They're impossible to find :))  Take for example the 'index_html' of
a folder: nothing else in my Zope app refers to it. But whenever
someone browses to http://my.zopeserver.com/folder they see that
'index_html'. No automatic method can guess what objects have become
irrelevant.

If you want to find everything that isn't refered to by another Zope
object, you could use 'sitecopy' to make a filesystem copy of everything
in your ZODB, 'ls -R' to get a list of filenames, and
'grep -r filename *' for each filename in the list. If the grep returns
nothing, nothing refers to that object.

You could do the same kind of thing ('ls -R' and 'grep') from the Zope
Management Interface using Jerome Alet's zshell.

-- 
Jean Jordaan
Upfront Systems                         http://www.upfrontsystems.co.za