r89406 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89405‎ | r89406 | r89407 >
Date:10:54, 3 June 2011
Author:happy-melon
Status:reverted (Comments)
Tags:
Comment:
Start unpicking r85288 (magic __get() accessor for RequestContext). Instead, bring back some of r86872 (abstract base class for classes providing access to RequestContext methods), which is a more 'classical' solution.
Modified paths:
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/RequestContext.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)
  • /trunk/phase3/includes/SpecialPageFactory.php (modified) (history)
  • /trunk/phase3/includes/Wiki.php (modified) (history)
  • /trunk/phase3/index.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialPageFactory.php
@@ -417,10 +417,10 @@
418418 $page = self::getPage( $name );
419419 // Nonexistent?
420420 if ( !$page ) {
421 - $context->output->setArticleRelated( false );
422 - $context->output->setRobotPolicy( 'noindex,nofollow' );
423 - $context->output->setStatusCode( 404 );
424 - $context->output->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
 421+ $context->getOutput()->setArticleRelated( false );
 422+ $context->getOutput()->setRobotPolicy( 'noindex,nofollow' );
 423+ $context->getOutput()->setStatusCode( 404 );
 424+ $context->getOutput()->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
425425 wfProfileOut( __METHOD__ );
426426 return false;
427427 }
@@ -434,17 +434,17 @@
435435 // the request. Such POST requests are possible for old extensions that
436436 // generate self-links without being aware that their default name has
437437 // changed.
438 - if ( $name != $page->getLocalName() && !$context->request->wasPosted() ) {
439 - $query = $context->request->getQueryValues();
 438+ if ( $name != $page->getLocalName() && !$context->getRequest()->wasPosted() ) {
 439+ $query = $context->getRequest()->getQueryValues();
440440 unset( $query['title'] );
441441 $query = wfArrayToCGI( $query );
442442 $title = $page->getTitle( $par );
443443 $url = $title->getFullUrl( $query );
444 - $context->output->redirect( $url );
 444+ $context->getOutput()->redirect( $url );
445445 wfProfileOut( __METHOD__ );
446446 return $title;
447447 } else {
448 - $context->title = $page->getTitle();
 448+ $context->setTitle( $page->getTitle() );
449449 }
450450
451451 } elseif ( !$page->isIncludable() ) {
Index: trunk/phase3/includes/RequestContext.php
@@ -9,7 +9,7 @@
1010 * @file
1111 */
1212
13 -class RequestContext {
 13+class RequestContext implements IContextSource {
1414
1515 /**
1616 * @var WebRequest
@@ -240,3 +240,134 @@
241241 }
242242 }
243243
 244+/**
 245+ * Interface for objects which can provide a context on request.
 246+ */
 247+interface IContextSource {
 248+
 249+ /**
 250+ * Get the WebRequest object
 251+ *
 252+ * @return WebRequest
 253+ */
 254+ public function getRequest();
 255+
 256+ /**
 257+ * Get the Title object
 258+ *
 259+ * @return Title
 260+ */
 261+ public function getTitle();
 262+
 263+ /**
 264+ * Get the OutputPage object
 265+ *
 266+ * @return OutputPage object
 267+ */
 268+ public function getOutput();
 269+
 270+ /**
 271+ * Get the User object
 272+ *
 273+ * @return User
 274+ */
 275+ public function getUser();
 276+
 277+ /**
 278+ * Get the Language object
 279+ *
 280+ * @return Language
 281+ */
 282+ public function getLang();
 283+
 284+ /**
 285+ * Get the Skin object
 286+ *
 287+ * @return Skin
 288+ */
 289+ public function getSkin();
 290+}
 291+
 292+/**
 293+ * The simplest way of implementing IContextSource is to hold a RequestContext as a
 294+ * member variable and provide accessors to it.
 295+ */
 296+abstract class ContextSource implements IContextSource {
 297+
 298+ /**
 299+ * @var RequestContext
 300+ */
 301+ private $context;
 302+
 303+ /**
 304+ * Get the RequestContext object
 305+ *
 306+ * @return RequestContext
 307+ */
 308+ public function getContext() {
 309+ return $this->context;
 310+ }
 311+
 312+ /**
 313+ * Set the RequestContext object
 314+ *
 315+ * @param $context RequestContext
 316+ */
 317+ public function setContext( RequestContext $context ) {
 318+ $this->context = $context;
 319+ }
 320+
 321+ /**
 322+ * Get the WebRequest object
 323+ *
 324+ * @return WebRequest
 325+ */
 326+ public function getRequest() {
 327+ return $this->context->getRequest();
 328+ }
 329+
 330+ /**
 331+ * Get the Title object
 332+ *
 333+ * @return Title
 334+ */
 335+ public function getTitle() {
 336+ return $this->context->getTitle();
 337+ }
 338+
 339+ /**
 340+ * Get the OutputPage object
 341+ *
 342+ * @return OutputPage object
 343+ */
 344+ public function getOutput() {
 345+ return $this->context->getOutput();
 346+ }
 347+
 348+ /**
 349+ * Get the User object
 350+ *
 351+ * @return User
 352+ */
 353+ public function getUser() {
 354+ return $this->context->getUser();
 355+ }
 356+
 357+ /**
 358+ * Get the Language object
 359+ *
 360+ * @return Language
 361+ */
 362+ public function getLang() {
 363+ return $this->context->getLang();
 364+ }
 365+
 366+ /**
 367+ * Get the Skin object
 368+ *
 369+ * @return Skin
 370+ */
 371+ public function getSkin() {
 372+ return $this->context->getSkin();
 373+ }
 374+}
\ No newline at end of file
Index: trunk/phase3/includes/AutoLoader.php
@@ -47,6 +47,7 @@
4848 'ConfEditor' => 'includes/ConfEditor.php',
4949 'ConfEditorParseError' => 'includes/ConfEditor.php',
5050 'ConfEditorToken' => 'includes/ConfEditor.php',
 51+ 'ContextSource' => 'includes/RequestContext.php',
5152 'Cookie' => 'includes/Cookie.php',
5253 'CookieJar' => 'includes/Cookie.php',
5354 'DiffHistoryBlob' => 'includes/HistoryBlob.php',
@@ -115,6 +116,7 @@
116117 'HTMLTextField' => 'includes/HTMLForm.php',
117118 'Http' => 'includes/HttpFunctions.php',
118119 'HttpRequest' => 'includes/HttpFunctions.old.php',
 120+ 'IContextSource' => 'includes/RequestContext.php',
119121 'IcuCollation' => 'includes/Collation.php',
120122 'ImageGallery' => 'includes/ImageGallery.php',
121123 'ImageHistoryList' => 'includes/ImagePage.php',
Index: trunk/phase3/includes/Wiki.php
@@ -4,25 +4,19 @@
55 *
66 * @internal documentation reviewed 15 Mar 2010
77 */
8 -class MediaWiki {
 8+class MediaWiki extends ContextSource {
99
10 - /**
11 - * TODO: fold $output, etc, into this
12 - * @var RequestContext
13 - */
14 - private $context;
15 -
1610 public function request( WebRequest $x = null ){
17 - return wfSetVar( $this->context->request, $x );
 11+ return wfSetVar( $this->getRequest(), $x );
1812 }
1913
2014 public function output( OutputPage $x = null ){
21 - return wfSetVar( $this->context->output, $x );
 15+ return wfSetVar( $this->getOutput(), $x );
2216 }
2317
2418 public function __construct( RequestContext $context ){
25 - $this->context = $context;
26 - $this->context->setTitle( $this->parseTitle() );
 19+ $this->setContext( $context );
 20+ $this->getContext()->setTitle( $this->parseTitle() );
2721 }
2822
2923 /**
@@ -33,10 +27,10 @@
3428 private function parseTitle() {
3529 global $wgContLang;
3630
37 - $curid = $this->context->request->getInt( 'curid' );
38 - $title = $this->context->request->getVal( 'title' );
 31+ $curid = $this->getRequest()->getInt( 'curid' );
 32+ $title = $this->getRequest()->getVal( 'title' );
3933
40 - if ( $this->context->request->getCheck( 'search' ) ) {
 34+ if ( $this->getRequest()->getCheck( 'search' ) ) {
4135 // Compatibility with old search URLs which didn't use Special:Search
4236 // Just check for presence here, so blank requests still
4337 // show the search page when using ugly URLs (bug 8054).
@@ -57,8 +51,8 @@
5852 // For non-special titles, check for implicit titles
5953 if ( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) {
6054 // We can have urls with just ?diff=,?oldid= or even just ?diff=
61 - $oldid = $this->context->request->getInt( 'oldid' );
62 - $oldid = $oldid ? $oldid : $this->context->request->getInt( 'diff' );
 55+ $oldid = $this->getRequest()->getInt( 'oldid' );
 56+ $oldid = $oldid ? $oldid : $this->getRequest()->getInt( 'diff' );
6357 // Allow oldid to override a changed or missing title
6458 if ( $oldid ) {
6559 $rev = Revision::newFromId( $oldid );
@@ -77,10 +71,10 @@
7872 * @return Title
7973 */
8074 public function getTitle(){
81 - if( $this->context->title === null ){
82 - $this->context->title = $this->parseTitle();
 75+ if( $this->getContext()->getTitle() === null ){
 76+ $this->getContext()->setTitle( $this->parseTitle() );
8377 }
84 - return $this->context->title;
 78+ return $this->getContext()->getTitle();
8579 }
8680
8781 /**
@@ -99,60 +93,60 @@
10094
10195 wfProfileIn( __METHOD__ );
10296
103 - if ( $this->context->request->getVal( 'printable' ) === 'yes' ) {
104 - $this->context->output->setPrintable();
 97+ if ( $this->getRequest()->getVal( 'printable' ) === 'yes' ) {
 98+ $this->getOutput()->setPrintable();
10599 }
106100
107101 wfRunHooks( 'BeforeInitialize', array(
108 - &$this->context->title,
 102+ $this->getTitle(),
109103 null,
110 - &$this->context->output,
111 - &$this->context->user,
112 - $this->context->request,
 104+ $this->getOutput(),
 105+ $this->getUser(),
 106+ $this->getRequest(),
113107 $this
114108 ) );
115109
116110 // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
117 - if ( $this->context->title instanceof BadTitle ) {
 111+ if ( $this->getTitle() instanceof BadTitle ) {
118112 throw new ErrorPageError( 'badtitle', 'badtitletext' );
119113 // If the user is not logged in, the Namespace:title of the article must be in
120114 // the Read array in order for the user to see it. (We have to check here to
121115 // catch special pages etc. We check again in Article::view())
122 - } else if ( !$this->context->title->userCanRead() ) {
123 - $this->context->output->loginToUse();
 116+ } else if ( !$this->getTitle()->userCanRead() ) {
 117+ $this->getOutput()->loginToUse();
124118 // Interwiki redirects
125 - } else if ( $this->context->title->getInterwiki() != '' ) {
126 - $rdfrom = $this->context->request->getVal( 'rdfrom' );
 119+ } else if ( $this->getTitle()->getInterwiki() != '' ) {
 120+ $rdfrom = $this->getRequest()->getVal( 'rdfrom' );
127121 if ( $rdfrom ) {
128 - $url = $this->context->title->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) );
 122+ $url = $this->getTitle()->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) );
129123 } else {
130 - $query = $this->context->request->getValues();
 124+ $query = $this->getRequest()->getValues();
131125 unset( $query['title'] );
132 - $url = $this->context->title->getFullURL( $query );
 126+ $url = $this->getTitle()->getFullURL( $query );
133127 }
134128 // Check for a redirect loop
135 - if ( !preg_match( '/^' . preg_quote( $wgServer, '/' ) . '/', $url ) && $this->context->title->isLocal() ) {
 129+ if ( !preg_match( '/^' . preg_quote( $wgServer, '/' ) . '/', $url ) && $this->getTitle()->isLocal() ) {
136130 // 301 so google et al report the target as the actual url.
137 - $this->context->output->redirect( $url, 301 );
 131+ $this->getOutput()->redirect( $url, 301 );
138132 } else {
139 - $this->context->title = new BadTitle;
 133+ $this->getContext()->setTitle( new BadTitle );
140134 wfProfileOut( __METHOD__ );
141135 throw new ErrorPageError( 'badtitle', 'badtitletext' );
142136 }
143137 // Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant
144 - } else if ( $this->context->request->getVal( 'action', 'view' ) == 'view' && !$this->context->request->wasPosted()
145 - && ( $this->context->request->getVal( 'title' ) === null || $this->context->title->getPrefixedDBKey() != $this->context->request->getVal( 'title' ) )
146 - && !count( array_diff( array_keys( $this->context->request->getValues() ), array( 'action', 'title' ) ) ) )
 138+ } else if ( $this->getRequest()->getVal( 'action', 'view' ) == 'view' && !$this->getRequest()->wasPosted()
 139+ && ( $this->getRequest()->getVal( 'title' ) === null || $this->getTitle()->getPrefixedDBKey() != $this->getRequest()->getVal( 'title' ) )
 140+ && !count( array_diff( array_keys( $this->getRequest()->getValues() ), array( 'action', 'title' ) ) ) )
147141 {
148 - if ( $this->context->title->getNamespace() == NS_SPECIAL ) {
149 - list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $this->context->title->getDBkey() );
 142+ if ( $this->getTitle()->getNamespace() == NS_SPECIAL ) {
 143+ list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $this->getTitle()->getDBkey() );
150144 if ( $name ) {
151 - $this->context->title = SpecialPage::getTitleFor( $name, $subpage );
 145+ $this->getContext()->setTitle( SpecialPage::getTitleFor( $name, $subpage ) );
152146 }
153147 }
154 - $targetUrl = $this->context->title->getFullURL();
 148+ $targetUrl = $this->getTitle()->getFullURL();
155149 // Redirect to canonical url, make it a 301 to allow caching
156 - if ( $targetUrl == $this->context->request->getFullRequestURL() ) {
 150+ if ( $targetUrl == $this->getRequest()->getFullRequestURL() ) {
157151 $message = "Redirect loop detected!\n\n" .
158152 "This means the wiki got confused about what page was " .
159153 "requested; this sometimes happens when moving a wiki " .
@@ -174,13 +168,13 @@
175169 }
176170 wfHttpError( 500, "Internal error", $message );
177171 } else {
178 - $this->context->output->setSquidMaxage( 1200 );
179 - $this->context->output->redirect( $targetUrl, '301' );
 172+ $this->getOutput()->setSquidMaxage( 1200 );
 173+ $this->getOutput()->redirect( $targetUrl, '301' );
180174 }
181175 // Special pages
182 - } else if ( NS_SPECIAL == $this->context->title->getNamespace() ) {
 176+ } else if ( NS_SPECIAL == $this->getTitle()->getNamespace() ) {
183177 // actions that need to be made when we have a special pages
184 - SpecialPageFactory::executePath( $this->context->title, $this->context );
 178+ SpecialPageFactory::executePath( $this->getTitle(), $this->getContext() );
185179 } else {
186180 // ...otherwise treat it as an article view. The article
187181 // may be a redirect to another article or URL.
@@ -190,7 +184,7 @@
191185 wfProfileOut( __METHOD__ );
192186 return $article;
193187 } elseif ( is_string( $article ) ) {
194 - $this->context->output->redirect( $article );
 188+ $this->getOutput()->redirect( $article );
195189 } else {
196190 wfProfileOut( __METHOD__ );
197191 throw new MWException( "Shouldn't happen: MediaWiki::initializeArticle() returned neither an object nor a URL" );
@@ -221,7 +215,7 @@
222216 public function getAction() {
223217 global $wgDisabledActions;
224218
225 - $action = $this->context->request->getVal( 'action', 'view' );
 219+ $action = $this->getRequest()->getVal( 'action', 'view' );
226220
227221 // Check for disabled actions
228222 if ( in_array( $action, $wgDisabledActions ) ) {
@@ -231,7 +225,7 @@
232226 // Workaround for bug #20966: inability of IE to provide an action dependent
233227 // on which submit button is clicked.
234228 if ( $action === 'historysubmit' ) {
235 - if ( $this->context->request->getBool( 'revisiondelete' ) ) {
 229+ if ( $this->getRequest()->getBool( 'revisiondelete' ) ) {
236230 return 'revisiondelete';
237231 } else {
238232 return 'view';
@@ -254,21 +248,21 @@
255249
256250 wfProfileIn( __METHOD__ );
257251
258 - $action = $this->context->request->getVal( 'action', 'view' );
259 - $article = Article::newFromTitle( $this->context->title, $this->context );
 252+ $action = $this->getRequest()->getVal( 'action', 'view' );
 253+ $article = Article::newFromTitle( $this->getTitle(), $this->getContext() );
260254 // NS_MEDIAWIKI has no redirects.
261255 // It is also used for CSS/JS, so performance matters here...
262 - if ( $this->context->title->getNamespace() == NS_MEDIAWIKI ) {
 256+ if ( $this->getTitle()->getNamespace() == NS_MEDIAWIKI ) {
263257 wfProfileOut( __METHOD__ );
264258 return $article;
265259 }
266260 // Namespace might change when using redirects
267261 // Check for redirects ...
268 - $file = ( $this->context->title->getNamespace() == NS_FILE ) ? $article->getFile() : null;
 262+ $file = ( $this->getTitle()->getNamespace() == NS_FILE ) ? $article->getFile() : null;
269263 if ( ( $action == 'view' || $action == 'render' ) // ... for actions that show content
270 - && !$this->context->request->getVal( 'oldid' ) && // ... and are not old revisions
271 - !$this->context->request->getVal( 'diff' ) && // ... and not when showing diff
272 - $this->context->request->getVal( 'redirect' ) != 'no' && // ... unless explicitly told not to
 264+ && !$this->getRequest()->getVal( 'oldid' ) && // ... and are not old revisions
 265+ !$this->getRequest()->getVal( 'diff' ) && // ... and not when showing diff
 266+ $this->getRequest()->getVal( 'redirect' ) != 'no' && // ... unless explicitly told not to
273267 // ... and the article is not a non-redirect image page with associated file
274268 !( is_object( $file ) && $file->exists() && !$file->getRedirected() ) )
275269 {
@@ -276,7 +270,7 @@
277271 $ignoreRedirect = $target = false;
278272
279273 wfRunHooks( 'InitializeArticleMaybeRedirect',
280 - array( &$this->context->title, &$this->context->request, &$ignoreRedirect, &$target, &$article ) );
 274+ array( $this->getTitle(), $this->getRequest(), &$ignoreRedirect, &$target, &$article ) );
281275
282276 // Follow redirects only for... redirects.
283277 // If $target is set, then a hook wanted to redirect.
@@ -292,16 +286,16 @@
293287 }
294288 if ( is_object( $target ) ) {
295289 // Rewrite environment to redirected article
296 - $rarticle = Article::newFromTitle( $target, $this->context );
 290+ $rarticle = Article::newFromTitle( $target, $this->getContext() );
297291 $rarticle->loadPageData();
298292 if ( $rarticle->exists() || ( is_object( $file ) && !$file->isLocal() ) ) {
299 - $rarticle->setRedirectedFrom( $this->context->title );
 293+ $rarticle->setRedirectedFrom( $this->getTitle() );
300294 $article = $rarticle;
301 - $this->context->title = $target;
 295+ $this->getContext()->setTitle( $target );
302296 }
303297 }
304298 } else {
305 - $this->context->title = $article->getTitle();
 299+ $this->getContext()->setTitle( $article->getTitle() );
306300 }
307301 }
308302 wfProfileOut( __METHOD__ );
@@ -318,7 +312,7 @@
319313 $factory = wfGetLBFactory();
320314 $factory->commitMasterChanges();
321315 // Output everything!
322 - $this->context->output->output();
 316+ $this->getOutput()->output();
323317 // Do any deferred jobs
324318 wfDoUpdates( 'commit' );
325319
@@ -397,8 +391,8 @@
398392 wfProfileIn( __METHOD__ );
399393
400394 if ( !wfRunHooks( 'MediaWikiPerformAction', array(
401 - $this->context->output, $article, $this->context->title,
402 - $this->context->user, $this->context->request, $this ) ) )
 395+ $this->getOutput(), $article, $this->getTitle(),
 396+ $this->getUser(), $this->getRequest(), $this ) ) )
403397 {
404398 wfProfileOut( __METHOD__ );
405399 return;
@@ -415,7 +409,7 @@
416410
417411 switch( $act ) {
418412 case 'view':
419 - $this->context->output->setSquidMaxage( $wgSquidMaxage );
 413+ $this->getOutput()->setSquidMaxage( $wgSquidMaxage );
420414 $article->view();
421415 break;
422416 case 'raw': // includes JS/CSS
@@ -442,25 +436,25 @@
443437 }
444438 // Continue...
445439 case 'edit':
446 - if ( wfRunHooks( 'CustomEditor', array( $article, $this->context->user ) ) ) {
447 - $internal = $this->context->request->getVal( 'internaledit' );
448 - $external = $this->context->request->getVal( 'externaledit' );
449 - $section = $this->context->request->getVal( 'section' );
450 - $oldid = $this->context->request->getVal( 'oldid' );
 440+ if ( wfRunHooks( 'CustomEditor', array( $article, $this->getUser() ) ) ) {
 441+ $internal = $this->getRequest()->getVal( 'internaledit' );
 442+ $external = $this->getRequest()->getVal( 'externaledit' );
 443+ $section = $this->getRequest()->getVal( 'section' );
 444+ $oldid = $this->getRequest()->getVal( 'oldid' );
451445 if ( !$wgUseExternalEditor || $act == 'submit' || $internal ||
452 - $section || $oldid || ( !$this->context->user->getOption( 'externaleditor' ) && !$external ) ) {
 446+ $section || $oldid || ( !$this->getUser()->getOption( 'externaleditor' ) && !$external ) ) {
453447 $editor = new EditPage( $article );
454448 $editor->submit();
455 - } elseif ( $wgUseExternalEditor && ( $external || $this->context->user->getOption( 'externaleditor' ) ) ) {
456 - $mode = $this->context->request->getVal( 'mode' );
 449+ } elseif ( $wgUseExternalEditor && ( $external || $this->getUser()->getOption( 'externaleditor' ) ) ) {
 450+ $mode = $this->getRequest()->getVal( 'mode' );
457451 $extedit = new ExternalEdit( $article, $mode );
458452 $extedit->edit();
459453 }
460454 }
461455 break;
462456 case 'history':
463 - if ( $this->context->request->getFullRequestURL() == $this->context->title->getInternalURL( 'action=history' ) ) {
464 - $this->context->output->setSquidMaxage( $wgSquidMaxage );
 457+ if ( $this->getRequest()->getFullRequestURL() == $this->getTitle()->getInternalURL( 'action=history' ) ) {
 458+ $this->getOutput()->setSquidMaxage( $wgSquidMaxage );
465459 }
466460 $history = new HistoryPage( $article );
467461 $history->history();
@@ -472,7 +466,7 @@
473467 break;
474468 default:
475469 if ( wfRunHooks( 'UnknownAction', array( $act, $article ) ) ) {
476 - $this->context->output->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
 470+ $this->getOutput()->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
477471 }
478472 }
479473 wfProfileOut( __METHOD__ );
Index: trunk/phase3/includes/SpecialPage.php
@@ -839,14 +839,14 @@
840840 // Redirect to a page title with possible query parameters
841841 if ( $redirect instanceof Title ) {
842842 $url = $redirect->getFullUrl( $query );
843 - $this->getContext()->output->redirect( $url );
 843+ $this->getOutput()->redirect( $url );
844844 wfProfileOut( __METHOD__ );
845845 return $redirect;
846846 // Redirect to index.php with query parameters
847847 } elseif ( $redirect === true ) {
848848 global $wgScript;
849849 $url = $wgScript . '?' . wfArrayToCGI( $query );
850 - $this->getContext()->output->redirect( $url );
 850+ $this->getOutput()->redirect( $url );
851851 wfProfileOut( __METHOD__ );
852852 return $redirect;
853853 } else {
Index: trunk/phase3/index.php
@@ -130,14 +130,14 @@
131131 $cache = new HTMLFileCache( $wgTitle, $action );
132132 if ( $cache->isFileCacheGood( /* Assume up to date */ ) ) {
133133 /* Check incoming headers to see if client has this cached */
134 - if ( !$context->output->checkLastModified( $cache->fileCacheTime() ) ) {
 134+ if ( !$context->getOutput()->checkLastModified( $cache->fileCacheTime() ) ) {
135135 $cache->loadFromFileCache();
136136 }
137137 # Do any stats increment/watchlist stuff
138138 $article = Article::newFromTitle( $wgTitle, $context );
139139 $article->viewUpdates();
140140 # Tell OutputPage that output is taken care of
141 - $context->output->disable();
 141+ $context->getOutput()->disable();
142142 wfProfileOut( 'index.php-filecache' );
143143 $mediaWiki->finalCleanup();
144144 wfProfileOut( 'index.php' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r89414Follow-up r89406 CR: another use of RequestContext::__get()happy-melon14:36, 3 June 2011
r89430Provisional revert of r89406, r89414: reference-related warnings need cleanup...brion18:48, 3 June 2011
r89794Recommit SpecialPage.php and SpecialPageFactory.php parts of r89406 (removal ...ialex20:00, 9 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85288Implement magic accessors for RequestContext variables: you can now just call...happy-melon22:09, 3 April 2011
r86872Implement an interface and abstract class to hold the widely-reused get(Reque...happy-melon17:37, 25 April 2011

Comments

#Comment by Nikerabbit (talk | contribs)   11:58, 3 June 2011

Here is one: Notice: Use of RequestContext::__get() is deprecated; use $context->getFoo() instead is deprecated. [Called from StubUserLang::_newObject in /www/sandwiki/includes/StubObject.php at line 151] in /www/sandwiki/includes/GlobalFunctions.php on line 3342

#Comment by Nikerabbit (talk | contribs)   16:40, 3 June 2011

Here is another one: Notice: Use of RequestContext::__get() is deprecated; use $context->getFoo() instead is deprecated. [Called from Skin::getCategories in /www/sandwiki/includes/Skin.php at line 604] in /www/sandwiki/includes/GlobalFunctions.php on line 3342

#Comment by Nikerabbit (talk | contribs)   16:46, 3 June 2011

Here is a third one: Strict Standards: Only variables should be passed by reference in /www/sandwiki/includes/Wiki.php on line 177

#Comment by Brion VIBBER (talk | contribs)   18:49, 3 June 2011

Ewwww... reference problems. I've reverted this for now in r89430; some notes on the commit summary there.

#Comment by Happy-melon (talk | contribs)   12:45, 4 June 2011

Grr, my error_reporting = E_ALL|E_STRICT) config is only in php.ini for some of my nine versions of PHP... /sulks

I'm afraid uni finals are a higher priority for me right now than redoing this, or otherwise reworking r85288. If people agree with the general principle of using a ContextSource base class, do go ahead and stick it back in. Otherwise I'll try and get back round to it sometime towards the end of June.

Status & tagging log