EZP-21324: image files can be removed by mistake

Since copies of archived versions aren't processed by eZDatatype::onPublish,
they still reference the same images than the original.

The removeAliases() method didn't take this into account, and could
delete images that were actually used by the original content.

This patch prevents the method from deleting images that don't have
an entry in ezimagefile.
EZP-21324: Added tests

Taken from https://github.com/ezsystems/ezpublish-legacy/pull/792
EZP-21913: Fix updateniceurls.php
EZP-21913: changelog2xmltext.php
EZP-21913: Fixed globals usage in ezasynchronouspublisher.php
EZP-21913: partially fixed ezwebincommon.php
EZP-21913: Fixed ezwebin*
EZP-21913: Fixed ezflowupgrade.php
Doc EZP-21913: Add bc note on global use in bin/php scripts
EZP-21913: runcronjobs.php
EZP-21913: ezsubtreecopy.php
EZP-21913: Fixed globals in bin/php/ezconvertdbcharset.php
EZP-21913: clusterize.php