EZP-21324: Fixed missing references to copied image attributes

See http://jira.ez.no/browse/EZP-21324

**Replaced by #825**

This PR fixes a use-case where image files from content A might be deleted when content B is deleted.

## Use-case
- create a content A with an image attribute
- edit content A, but don't change the image.
  - Version 1 references the file. An entry exists in ezimagefile.
  - Version 2 will reference the same image than version 1. A (duplicate) entry exists in ezimagefile.
- copy content A to content B
  - Version 1 references the *same* image than A version 1. There is no reference from this attribute to the image in ezimagefile
  - Version 2 references a copy (actually a hard link, but it doesn't matter) of the image from A version 2. An entry exists in ezimagefile.

The consequence is that when B version 1 gets deleted (either manually, or because the version limit gets reached, or when B is deleted, the image used by A (both versions) will get deleted.

## Fix
The PR fixes:
- what is done when copying (by adding references to the image used in v1 to ezimagefile)
- what is done when deleting (usage of the image is checked for any attribute, using ezimagefile, since we have proper references)
- existing data, by providing an update script, [update/common/scripts/5.3/recreateimagesreferences.php](https://github.com/ezsystems/ezpublish-legacy/blob/fix/EZP-21324-copy_old_version_images/update/common/scripts/5.3/recreateimagesreferences.php). The script goes through all ezimage attributes, and adds missing references to ezimagefile.

## Changes

Removal of aliases has been totally refactored, and should work fine with the way we store data now.
`purgeAliases()`, used by eZCache, has been refactored to use the same code (with tests).

## TODO
- [x] Fix the `removeAliases()` code (used when a specific version is removed)
- [x] Fix the postgresql error in `eZImageFile::fetchListByFilePath()` (group by error)
- [x] Fix the `removeAllAliases()` code (used when a complete content object is removed)
- [x] Fix the remaining reference to the deleted attribute left in the database when deleting a copy of an image content
- [x] Improve tests to check that no `ezimagefile` records are left behind
- [ ] Add translated data to tests
- [ ] Rebase, keeping tests in separate commits for backport