Martineznovo has uploaded a new change for review.

Change subject: (bug 27202) Add timestamp sort to list=allimages
......................................................................

(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.

All 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.

Some of them simply doesn't make sense, like filtering by SHA when
sorting by timestamp.

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

In function run:

* Added USE INDEX query options when sort=timestamp to ensure the proper
  index is being used.
* $wgMiserMode moved at the top of function run for readability reasons.
* 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
---
M includes/api/ApiQueryAllImages.php
1 file changed, 189 insertions(+), 69 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/84/23984/1
--
To view, visit https://gerrit.wikimedia.org/r/23984
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide2ff3dbc3e617e749685d558444854617535bab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Martineznovo <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to