ezsystems/ezpublish-legacy — pull request #982 by joaoinacio (2014-05-27 16:10:28+00:00)
Title: [WIP] Fix EZP-22913: prevent exponential growth in number of queries when remo...

...ving image alias attributes

JIRA: https://jira.ez.no/browse/EZP-22913

The current method for removing image alias allows the queries to grow exponentially, which in edge cases can result in many thousands of queries executed.

This fixes the issue by replacing the existing logic in `eZImageAliasHandler` with:
- A single query to verify the existance of other attributes using the file (in which case the file may or may not be removed).
- A single query to verify if there are any referenced attributes may be removed.

TODO:
- [ ] When removing an image attribute (version), the call to `removeAliases()` will check the the aliases for all versions, every time. This needs further investigation.