Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/59974


Change subject: Do not allow sorting Special:Listfiles by img_name when 
filtering by username
......................................................................

Do not allow sorting Special:Listfiles by img_name when filtering by username

We don't allow sorting by img_size due to lack of index. For consistency
we shouldn't allow by img_name either, since there is similarly
no index on (img_user_text, img_name) either

Also, let filtering by img_size when not in miser mode.

Change-Id: I5aaf1a3f39ddc23d5d009ada199b63a0e3133ef3
---
M RELEASE-NOTES-1.22
M includes/specials/SpecialListfiles.php
2 files changed, 11 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/74/59974/1

diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 5c6de79..e1870fd 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -41,6 +41,8 @@
   is now non-significant and not preserved in the HTML output.
 * (bug 47218) Special:BlockList now handles correctly user names with spaces
   when passed as subpage.
+* Special:Listfiles can no longer be sorted by image name when filtering
+  by user in miser mode.
 
 === API changes in 1.22 ===
 * (bug 46626) xmldoublequote parameter was removed. Because of a bug, the
diff --git a/includes/specials/SpecialListfiles.php 
b/includes/specials/SpecialListfiles.php
index c864ae2..b87ee3e 100644
--- a/includes/specials/SpecialListfiles.php
+++ b/includes/specials/SpecialListfiles.php
@@ -126,13 +126,18 @@
        }
 
        function isFieldSortable( $field ) {
+               global $wgMiserMode;
                if ( $this->mIncluding ) {
                        return false;
                }
-               static $sortable = array( 'img_timestamp', 'img_name' );
-               if ( $field == 'img_size' ) {
-                       # No index for both img_size and img_user_text
-                       return !isset( $this->mQueryConds['img_user_text'] );
+               $sortable = array( 'img_timestamp', 'img_name', 'img_size' );
+               if ( $wgMiserMode && isset( $this->mQueryConds['img_user_text'] 
) ) {
+                       // If we're sorting by user, the index only supports 
sorting by time
+                       if ( $field === 'img_timestamp' ) {
+                               return true;
+                       } else {
+                               return false;
+                       }
                }
                return in_array( $field, $sortable );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/59974
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

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

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

Reply via email to