Merge "Make the global objects documentation consistent in Setup.php"
[lhc/web/wiklou.git] / includes / specials / SpecialMIMEsearch.php
index 50af915..4d9e7da 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(
@@ -82,7 +86,7 @@ class MIMEsearchPage extends QueryPage {
                                        MEDIATYPE_EXECUTABLE,
                                        MEDIATYPE_ARCHIVE,
                                ),
-                       ),
+                       ) + $minorType,
                );
 
                return $qi;
@@ -104,6 +108,7 @@ class MIMEsearchPage extends QueryPage {
                global $wgScript;
 
                $mime = $par ? $par : $this->getRequest()->getText( 'mime' );
+               $mime = trim( $mime );
 
                $this->setHeaders();
                $this->outputHeader();
@@ -166,7 +171,7 @@ class MIMEsearchPage extends QueryPage {
        }
 
        /**
-        * @param $type string
+        * @param string $type
         * @return bool
         */
        protected static function isValidType( $type ) {