ezsystems/ezpublish-legacy — pull request #989 by bdunogier (2014-06-03 17:40:08+00:00)
Title: Fix EZP-22913: prevent exponential query growth when removing image alias

> Re-push of https://github.com/ezsystems/ezpublish-legacy/pull/982 by @joaoinacio
> Fixes [EZP-22913](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.