r77892 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77891‎ | r77892 | r77893 >
Date:17:42, 6 December 2010
Author:ialex
Status:ok
Tags:
Comment:
Check for the "search" along with other checks to create the Title object. Since this was done after the call to $wgOut->setTitle(), the Title object holded in that instance was incorrect when a such request happened
Modified paths:
  • /trunk/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Wiki.php
@@ -55,7 +55,7 @@
5656
5757 wfRunHooks( 'BeforeInitialize', array( &$title, &$article, &$output, &$user, $request, $this ) );
5858
59 - if( !$this->preliminaryChecks( $title, $output, $request ) ) {
 59+ if( !$this->preliminaryChecks( $title, $output ) ) {
6060 wfProfileOut( __METHOD__ );
6161 return;
6262 }
@@ -110,7 +110,12 @@
111111 }
112112
113113 $curid = $wgRequest->getInt( 'curid' );
114 - if( $curid ) {
 114+ if( $wgRequest->getCheck( 'search' ) ) {
 115+ // Compatibility with old search URLs which didn't use Special:Search
 116+ // Just check for presence here, so blank requests still
 117+ // show the search page when using ugly URLs (bug 8054).
 118+ $ret = SpecialPage::getTitleFor( 'Search' );
 119+ } elseif( $curid ) {
115120 // URLs like this are generated by RC, because rc_title isn't always accurate
116121 $ret = Title::newFromID( $curid );
117122 } elseif( $title == '' && $action != 'delete' ) {
@@ -137,22 +142,13 @@
138143 }
139144
140145 /**
141 - * Checks for search query and anon-cannot-read case
 146+ * Checks for anon-cannot-read case
142147 *
143148 * @param $title Title
144149 * @param $output OutputPage
145 - * @param $request WebRequest
146150 * @return boolean true if successful
147151 */
148 - function preliminaryChecks( &$title, &$output, $request ) {
149 - if( $request->getCheck( 'search' ) ) {
150 - // Compatibility with old search URLs which didn't use Special:Search
151 - // Just check for presence here, so blank requests still
152 - // show the search page when using ugly URLs (bug 8054).
153 -
154 - // Do this above the read whitelist check for security...
155 - $title = SpecialPage::getTitleFor( 'Search' );
156 - }
 152+ function preliminaryChecks( &$title, &$output ) {
157153 // If the user is not logged in, the Namespace:title of the article must be in
158154 // the Read array in order for the user to see it. (We have to check here to
159155 // catch special pages etc. We check again in Article::view())

Status & tagging log