jenkins-bot has submitted this change and it was merged.

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

Approvals:
  Parent5446: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 24081db..bee178d 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -187,6 +187,8 @@
   the #toc CSS id and the .toc CSS class). However, particularly bad abuse of
   the id or the class can possibly break.
 * CSSJanus now supports rgb, hsl, rgba, and hsla color syntaxes.
+* Special:Listfiles can no longer be sorted by image name when filtering
+  by user in miser mode.
 
 === API changes in 1.22 ===
 * (bug 25553) The JSON output formatter now leaves forward slashes unescaped
diff --git a/includes/specials/SpecialListfiles.php 
b/includes/specials/SpecialListfiles.php
index 070cdea..24bd19f 100644
--- a/includes/specials/SpecialListfiles.php
+++ b/includes/specials/SpecialListfiles.php
@@ -134,13 +134,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: merged
Gerrit-Change-Id: I5aaf1a3f39ddc23d5d009ada199b63a0e3133ef3
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Asher <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: IAlex <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to