Check for the "search" along with other checks to create the Title object. Since...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 6 Dec 2010 17:42:14 +0000 (17:42 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 6 Dec 2010 17:42:14 +0000 (17:42 +0000)
includes/Wiki.php

index bc5ad01..d8bd09c 100644 (file)
@@ -55,7 +55,7 @@ class MediaWiki {
 
                wfRunHooks( 'BeforeInitialize', array( &$title, &$article, &$output, &$user, $request, $this ) );
 
-               if( !$this->preliminaryChecks( $title, $output, $request ) ) {
+               if( !$this->preliminaryChecks( $title, $output ) ) {
                        wfProfileOut( __METHOD__ );
                        return;
                }
@@ -110,7 +110,12 @@ class MediaWiki {
                }
 
                $curid = $wgRequest->getInt( 'curid' );
-               if( $curid ) {
+               if( $wgRequest->getCheck( 'search' ) ) {
+                       // Compatibility with old search URLs which didn't use Special:Search
+                       // Just check for presence here, so blank requests still
+                       // show the search page when using ugly URLs (bug 8054).
+                       $ret = SpecialPage::getTitleFor( 'Search' );
+               } elseif( $curid ) {
                        // URLs like this are generated by RC, because rc_title isn't always accurate
                        $ret = Title::newFromID( $curid );
                } elseif( $title == '' && $action != 'delete' ) {
@@ -137,22 +142,13 @@ class MediaWiki {
        }
 
        /**
-        * Checks for search query and anon-cannot-read case
+        * Checks for anon-cannot-read case
         *
         * @param $title Title
         * @param $output OutputPage
-        * @param $request WebRequest
         * @return boolean true if successful
         */
-       function preliminaryChecks( &$title, &$output, $request ) {
-               if( $request->getCheck( 'search' ) ) {
-                       // Compatibility with old search URLs which didn't use Special:Search
-                       // Just check for presence here, so blank requests still
-                       // show the search page when using ugly URLs (bug 8054).
-
-                       // Do this above the read whitelist check for security...
-                       $title = SpecialPage::getTitleFor( 'Search' );
-               }
+       function preliminaryChecks( &$title, &$output ) {
                // If the user is not logged in, the Namespace:title of the article must be in
                // the Read array in order for the user to see it. (We have to check here to
                // catch special pages etc. We check again in Article::view())