Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.


When a new version of an object is created when using eZ Publish 4.2 and above, the images of the first version are put into storage. But when the first version is deleted, the images are not removed completely, but remain in storage. This implies that these images are still accessible with their URL and that they have been indexed by Google. To prevent for example copyright issues, it is recommended that these images are deleted as well. Therefore it is necessary to clear expired binary items from your database cluster installations (such as eZ DB and eZ DFS). This can be done with one of two ways, either by running a script or a cronjob, depending on how regular you wish or need to delete expired images.

Use the first method for occasional maintenance. You can for example use this starting from eZ Publish 5 in order to clean up your existing setup.
Run the following script fron your ezpublish_legacy directory (how to do this depends on your system):


If needed you can use the following options (Use --help to view all possible options):

  • dry-run: to display deleted files, without deleting anything (only applies to the bin script)
  • iteration-sleep: to pause time, in seconds, between each batch of delete operations. The default value is 1 second. Can be used as a floating point number.
  • iteration-limit: to set how many files should be deleted by SQL fetch. The default value is 100, but note that increasing this value will increase the memory footprint.
  • memory-monitoring: to monitor memory usage in var/log/clusterbinarypurge.log.
  • scopes: to specify the file types to purge. Possible values are: classattridentifiers, classidentifiers, content, expirycache, statelimitations, template-block, user-info-cache, viewcache, wildcard-cache-index, image, binaryfile or media.
  • expiry: to choose the number of days since the file was expired. Only files older than the defined value will be purged. Default is 30, minimum is 1.

The second way is by means of a cronjob and should be used for regular maintenance. The necessary cronjob is located here:


This cronjob is by default part of a cronjob named cluster_maintenance. Run it with the following script from your ezpublish_legacy directory:

$php runcronjobs.php cluster_maintenance -s ezwebin_site

Note that "$php" should be replaced by the path to your php executable. Also how to run a script can differ depending on your system. Please consult your systems manual for more information.

It is recommended to run this cronjob weekly, although it can be done more frequently for websites where binary files are removed frequently. For more information please visit our Issue Tracker: issue 015793.

Clean a DFS cluster install from stale DB files

A new script has been added for the purpose of cleaning a DFS cluster install from stale files in DB that do not exist on NFS and the opposite too. Run the following script from your ezpublish_legacy directory to clean stale DB files:



  • -S Check files on DFS share against files in the database
  • -B Checks files in database against files on DFS share
  • -D Delete nonexistent files

It is recommended to first run it WITHOUT the -D switch to see which files are going to be removed. For more information please visit our Issue Tracker: #018508

Note: ANY file located in MountPointPath is likely to be removed. Thus any file that is NOT contained in eZ Publish cluster will be removed if using -D switch. Please read DFS installation guide and issue #19059 for more information.

Two new options have been added to dfscleanup.php: iteration-limit and path. The first one limits how many items are fetched at the same time when purging, and the second one limits the path we check items for, like var/ezwebin_site/storage.

--path=VALUE                      Path to limit checks to (e.g.: <span class="code-keyword">var</span>/storage/content - Default: <span class="code-keyword">var</span>/)
--iteration-limit=VALUE        Amount of items to remove in each iteration when performing a purge operation. Default is all in one iteration.

Ester Heylen (14/09/2010 12:35 pm)

Ricardo Correia (29/01/2013 12:34 pm)

Geir Arne Waaler, Bertrand Dunogier, Jérôme Vieilledent, Andrea Melo, Ricardo Correia


There are no comments.