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 after upgrading to eZ Publish 4.5 in order to clean up your existing setup. Run the following script (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 the root of the eZ Publish 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.
Ester Heylen (14/09/2010 2:35 pm)
Ricardo Correia (29/01/2013 1:29 pm)