Allow using wildcards for minor type in Special:MIMESearch
authorBrian Wolff <bawolff+wn@gmail.com>
Mon, 9 Jun 2014 05:05:17 +0000 (02:05 -0300)
committerReedy <reedy@wikimedia.org>
Thu, 19 Jun 2014 09:41:22 +0000 (09:41 +0000)
e.g. Allow [[Special:MIMESearch/application/*]].

Change-Id: Ic098b10a64e3346d58c94f2dbfbb552dd809e93d

includes/specials/SpecialMIMEsearch.php
languages/i18n/en.json

index a2ae210..cb9dac9 100644 (file)
@@ -51,6 +51,11 @@ class MIMEsearchPage extends QueryPage {
        }
 
        public function getQueryInfo() {
+               $minorType = array();
+               if ( $this->minor !== '*' ) {
+                       // Allow wildcard searching
+                       $minorType['img_minor_mime'] = $this->minor;
+               }
                $qi = array(
                        'tables' => array( 'image' ),
                        'fields' => array(
@@ -67,7 +72,6 @@ class MIMEsearchPage extends QueryPage {
                        ),
                        'conds' => array(
                                'img_major_mime' => $this->major,
-                               'img_minor_mime' => $this->minor,
                                // This is in order to trigger using
                                // the img_media_mime index in "range" mode.
                                'img_media_type' => array(
@@ -81,7 +85,7 @@ class MIMEsearchPage extends QueryPage {
                                        MEDIATYPE_TEXT,
                                        MEDIATYPE_EXECUTABLE,
                                        MEDIATYPE_ARCHIVE,
-                               ),
+                               ) + $minorType,
                        ),
                );
 
index 14b6b66..5d8cd9a 100644 (file)
        "filedelete-maintenance": "Deletion and restoration of files temporarily disabled during maintenance.",
        "filedelete-maintenance-title": "Cannot delete file",
        "mimesearch": "MIME search",
-       "mimesearch-summary": "This page enables the filtering of files for their MIME type.\nInput: contenttype/subtype, e.g. <code>image/jpeg</code>.",
+       "mimesearch-summary": "This page enables the filtering of files for their MIME type.\nInput: contenttype/subtype or contenttype/*, e.g. <code>image/jpeg</code>.",
        "mimetype": "MIME type:",
        "download": "download",
        "unwatchedpages": "Unwatched pages",