Merge "Fix the (un)watch token to include the namespace name."
[lhc/web/wiklou.git] / includes / specials / SpecialMIMEsearch.php
index a2ae210..3f1850d 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;
@@ -101,8 +105,6 @@ class MIMEsearchPage extends QueryPage {
        }
 
        function execute( $par ) {
-               global $wgScript;
-
                $mime = $par ? $par : $this->getRequest()->getText( 'mime' );
                $mime = trim( $mime );
 
@@ -111,7 +113,7 @@ class MIMEsearchPage extends QueryPage {
                $this->getOutput()->addHTML(
                        Xml::openElement(
                                'form',
-                               array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => $wgScript )
+                               array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => wfScript() )
                        ) .
                                Xml::openElement( 'fieldset' ) .
                                Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) .