(bug 27202) Add timestamp sort to list=allimages
New parameter 'sort' that defaults to 'name' so if not specified it will
act exactly as before.
Changes in the access to $params['dir'] to a boolean variable
$ascendingOrder in a try to be more meaningful.
Some existing filtering parameters are mutually exclusive with new ones.
The reason is because the table is sorted by name, as primary key, while
sorting by timestamp use the timestamp or usertext_timestamp index which
is not the primary key, thus filtering and ordering by different indices
doesn't make an efficient index usage.
Exceptions are:
* mime: disabled in Miser Mode
* size: although there's apparently no use for this when sorting by
timestamp, there's an index on that and the EXPLAIN doesn't use filesort
algorythm (unlike other combinations):
EXPLAIN
select img_name, img_user_text, img_timestamp
from image
where img_size>=1000 and img_size<=20000
and img_timestamp > '
20120916153705'
ORDER BY img_timestamp\G
* Same for sha1 (see comment on Patchset 1)
In function run:
* Added USE INDEX query options when sort=timestamp to ensure the proper
index is being used.
* Table selection and result fields moved at top, then filter parameters,
and finally order by and options.
Parameter description and definition sorted by purpose: sort and dir
first, then pagination, result fields, filters and limit.
Change-Id: Ide2ff3dbc3e617e749685d558444854617535bab