Index: trunk/phase3/includes/SpecialPageFactory.php |
— | — | @@ -417,10 +417,10 @@ |
418 | 418 | $page = self::getPage( $name ); |
419 | 419 | // Nonexistent? |
420 | 420 | 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' ); |
425 | 425 | wfProfileOut( __METHOD__ ); |
426 | 426 | return false; |
427 | 427 | } |
— | — | @@ -434,17 +434,17 @@ |
435 | 435 | // the request. Such POST requests are possible for old extensions that |
436 | 436 | // generate self-links without being aware that their default name has |
437 | 437 | // 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(); |
440 | 440 | unset( $query['title'] ); |
441 | 441 | $query = wfArrayToCGI( $query ); |
442 | 442 | $title = $page->getTitle( $par ); |
443 | 443 | $url = $title->getFullUrl( $query ); |
444 | | - $context->output->redirect( $url ); |
| 444 | + $context->getOutput()->redirect( $url ); |
445 | 445 | wfProfileOut( __METHOD__ ); |
446 | 446 | return $title; |
447 | 447 | } else { |
448 | | - $context->title = $page->getTitle(); |
| 448 | + $context->setTitle( $page->getTitle() ); |
449 | 449 | } |
450 | 450 | |
451 | 451 | } elseif ( !$page->isIncludable() ) { |
Index: trunk/phase3/includes/RequestContext.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * @file |
11 | 11 | */ |
12 | 12 | |
13 | | -class RequestContext { |
| 13 | +class RequestContext implements IContextSource { |
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @var WebRequest |
— | — | @@ -240,3 +240,134 @@ |
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
| 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 @@ |
48 | 48 | 'ConfEditor' => 'includes/ConfEditor.php', |
49 | 49 | 'ConfEditorParseError' => 'includes/ConfEditor.php', |
50 | 50 | 'ConfEditorToken' => 'includes/ConfEditor.php', |
| 51 | + 'ContextSource' => 'includes/RequestContext.php', |
51 | 52 | 'Cookie' => 'includes/Cookie.php', |
52 | 53 | 'CookieJar' => 'includes/Cookie.php', |
53 | 54 | 'DiffHistoryBlob' => 'includes/HistoryBlob.php', |
— | — | @@ -115,6 +116,7 @@ |
116 | 117 | 'HTMLTextField' => 'includes/HTMLForm.php', |
117 | 118 | 'Http' => 'includes/HttpFunctions.php', |
118 | 119 | 'HttpRequest' => 'includes/HttpFunctions.old.php', |
| 120 | + 'IContextSource' => 'includes/RequestContext.php', |
119 | 121 | 'IcuCollation' => 'includes/Collation.php', |
120 | 122 | 'ImageGallery' => 'includes/ImageGallery.php', |
121 | 123 | 'ImageHistoryList' => 'includes/ImagePage.php', |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -4,25 +4,19 @@ |
5 | 5 | * |
6 | 6 | * @internal documentation reviewed 15 Mar 2010 |
7 | 7 | */ |
8 | | -class MediaWiki { |
| 8 | +class MediaWiki extends ContextSource { |
9 | 9 | |
10 | | - /** |
11 | | - * TODO: fold $output, etc, into this |
12 | | - * @var RequestContext |
13 | | - */ |
14 | | - private $context; |
15 | | - |
16 | 10 | public function request( WebRequest $x = null ){ |
17 | | - return wfSetVar( $this->context->request, $x ); |
| 11 | + return wfSetVar( $this->getRequest(), $x ); |
18 | 12 | } |
19 | 13 | |
20 | 14 | public function output( OutputPage $x = null ){ |
21 | | - return wfSetVar( $this->context->output, $x ); |
| 15 | + return wfSetVar( $this->getOutput(), $x ); |
22 | 16 | } |
23 | 17 | |
24 | 18 | 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() ); |
27 | 21 | } |
28 | 22 | |
29 | 23 | /** |
— | — | @@ -33,10 +27,10 @@ |
34 | 28 | private function parseTitle() { |
35 | 29 | global $wgContLang; |
36 | 30 | |
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' ); |
39 | 33 | |
40 | | - if ( $this->context->request->getCheck( 'search' ) ) { |
| 34 | + if ( $this->getRequest()->getCheck( 'search' ) ) { |
41 | 35 | // Compatibility with old search URLs which didn't use Special:Search |
42 | 36 | // Just check for presence here, so blank requests still |
43 | 37 | // show the search page when using ugly URLs (bug 8054). |
— | — | @@ -57,8 +51,8 @@ |
58 | 52 | // For non-special titles, check for implicit titles |
59 | 53 | if ( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) { |
60 | 54 | // 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' ); |
63 | 57 | // Allow oldid to override a changed or missing title |
64 | 58 | if ( $oldid ) { |
65 | 59 | $rev = Revision::newFromId( $oldid ); |
— | — | @@ -77,10 +71,10 @@ |
78 | 72 | * @return Title |
79 | 73 | */ |
80 | 74 | 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() ); |
83 | 77 | } |
84 | | - return $this->context->title; |
| 78 | + return $this->getContext()->getTitle(); |
85 | 79 | } |
86 | 80 | |
87 | 81 | /** |
— | — | @@ -99,60 +93,60 @@ |
100 | 94 | |
101 | 95 | wfProfileIn( __METHOD__ ); |
102 | 96 | |
103 | | - if ( $this->context->request->getVal( 'printable' ) === 'yes' ) { |
104 | | - $this->context->output->setPrintable(); |
| 97 | + if ( $this->getRequest()->getVal( 'printable' ) === 'yes' ) { |
| 98 | + $this->getOutput()->setPrintable(); |
105 | 99 | } |
106 | 100 | |
107 | 101 | wfRunHooks( 'BeforeInitialize', array( |
108 | | - &$this->context->title, |
| 102 | + $this->getTitle(), |
109 | 103 | null, |
110 | | - &$this->context->output, |
111 | | - &$this->context->user, |
112 | | - $this->context->request, |
| 104 | + $this->getOutput(), |
| 105 | + $this->getUser(), |
| 106 | + $this->getRequest(), |
113 | 107 | $this |
114 | 108 | ) ); |
115 | 109 | |
116 | 110 | // 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 ) { |
118 | 112 | throw new ErrorPageError( 'badtitle', 'badtitletext' ); |
119 | 113 | // If the user is not logged in, the Namespace:title of the article must be in |
120 | 114 | // the Read array in order for the user to see it. (We have to check here to |
121 | 115 | // 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(); |
124 | 118 | // 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' ); |
127 | 121 | if ( $rdfrom ) { |
128 | | - $url = $this->context->title->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) ); |
| 122 | + $url = $this->getTitle()->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) ); |
129 | 123 | } else { |
130 | | - $query = $this->context->request->getValues(); |
| 124 | + $query = $this->getRequest()->getValues(); |
131 | 125 | unset( $query['title'] ); |
132 | | - $url = $this->context->title->getFullURL( $query ); |
| 126 | + $url = $this->getTitle()->getFullURL( $query ); |
133 | 127 | } |
134 | 128 | // 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() ) { |
136 | 130 | // 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 ); |
138 | 132 | } else { |
139 | | - $this->context->title = new BadTitle; |
| 133 | + $this->getContext()->setTitle( new BadTitle ); |
140 | 134 | wfProfileOut( __METHOD__ ); |
141 | 135 | throw new ErrorPageError( 'badtitle', 'badtitletext' ); |
142 | 136 | } |
143 | 137 | // 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' ) ) ) ) |
147 | 141 | { |
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() ); |
150 | 144 | if ( $name ) { |
151 | | - $this->context->title = SpecialPage::getTitleFor( $name, $subpage ); |
| 145 | + $this->getContext()->setTitle( SpecialPage::getTitleFor( $name, $subpage ) ); |
152 | 146 | } |
153 | 147 | } |
154 | | - $targetUrl = $this->context->title->getFullURL(); |
| 148 | + $targetUrl = $this->getTitle()->getFullURL(); |
155 | 149 | // Redirect to canonical url, make it a 301 to allow caching |
156 | | - if ( $targetUrl == $this->context->request->getFullRequestURL() ) { |
| 150 | + if ( $targetUrl == $this->getRequest()->getFullRequestURL() ) { |
157 | 151 | $message = "Redirect loop detected!\n\n" . |
158 | 152 | "This means the wiki got confused about what page was " . |
159 | 153 | "requested; this sometimes happens when moving a wiki " . |
— | — | @@ -174,13 +168,13 @@ |
175 | 169 | } |
176 | 170 | wfHttpError( 500, "Internal error", $message ); |
177 | 171 | } 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' ); |
180 | 174 | } |
181 | 175 | // Special pages |
182 | | - } else if ( NS_SPECIAL == $this->context->title->getNamespace() ) { |
| 176 | + } else if ( NS_SPECIAL == $this->getTitle()->getNamespace() ) { |
183 | 177 | // 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() ); |
185 | 179 | } else { |
186 | 180 | // ...otherwise treat it as an article view. The article |
187 | 181 | // may be a redirect to another article or URL. |
— | — | @@ -190,7 +184,7 @@ |
191 | 185 | wfProfileOut( __METHOD__ ); |
192 | 186 | return $article; |
193 | 187 | } elseif ( is_string( $article ) ) { |
194 | | - $this->context->output->redirect( $article ); |
| 188 | + $this->getOutput()->redirect( $article ); |
195 | 189 | } else { |
196 | 190 | wfProfileOut( __METHOD__ ); |
197 | 191 | throw new MWException( "Shouldn't happen: MediaWiki::initializeArticle() returned neither an object nor a URL" ); |
— | — | @@ -221,7 +215,7 @@ |
222 | 216 | public function getAction() { |
223 | 217 | global $wgDisabledActions; |
224 | 218 | |
225 | | - $action = $this->context->request->getVal( 'action', 'view' ); |
| 219 | + $action = $this->getRequest()->getVal( 'action', 'view' ); |
226 | 220 | |
227 | 221 | // Check for disabled actions |
228 | 222 | if ( in_array( $action, $wgDisabledActions ) ) { |
— | — | @@ -231,7 +225,7 @@ |
232 | 226 | // Workaround for bug #20966: inability of IE to provide an action dependent |
233 | 227 | // on which submit button is clicked. |
234 | 228 | if ( $action === 'historysubmit' ) { |
235 | | - if ( $this->context->request->getBool( 'revisiondelete' ) ) { |
| 229 | + if ( $this->getRequest()->getBool( 'revisiondelete' ) ) { |
236 | 230 | return 'revisiondelete'; |
237 | 231 | } else { |
238 | 232 | return 'view'; |
— | — | @@ -254,21 +248,21 @@ |
255 | 249 | |
256 | 250 | wfProfileIn( __METHOD__ ); |
257 | 251 | |
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() ); |
260 | 254 | // NS_MEDIAWIKI has no redirects. |
261 | 255 | // 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 ) { |
263 | 257 | wfProfileOut( __METHOD__ ); |
264 | 258 | return $article; |
265 | 259 | } |
266 | 260 | // Namespace might change when using redirects |
267 | 261 | // Check for redirects ... |
268 | | - $file = ( $this->context->title->getNamespace() == NS_FILE ) ? $article->getFile() : null; |
| 262 | + $file = ( $this->getTitle()->getNamespace() == NS_FILE ) ? $article->getFile() : null; |
269 | 263 | 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 |
273 | 267 | // ... and the article is not a non-redirect image page with associated file |
274 | 268 | !( is_object( $file ) && $file->exists() && !$file->getRedirected() ) ) |
275 | 269 | { |
— | — | @@ -276,7 +270,7 @@ |
277 | 271 | $ignoreRedirect = $target = false; |
278 | 272 | |
279 | 273 | wfRunHooks( 'InitializeArticleMaybeRedirect', |
280 | | - array( &$this->context->title, &$this->context->request, &$ignoreRedirect, &$target, &$article ) ); |
| 274 | + array( $this->getTitle(), $this->getRequest(), &$ignoreRedirect, &$target, &$article ) ); |
281 | 275 | |
282 | 276 | // Follow redirects only for... redirects. |
283 | 277 | // If $target is set, then a hook wanted to redirect. |
— | — | @@ -292,16 +286,16 @@ |
293 | 287 | } |
294 | 288 | if ( is_object( $target ) ) { |
295 | 289 | // Rewrite environment to redirected article |
296 | | - $rarticle = Article::newFromTitle( $target, $this->context ); |
| 290 | + $rarticle = Article::newFromTitle( $target, $this->getContext() ); |
297 | 291 | $rarticle->loadPageData(); |
298 | 292 | if ( $rarticle->exists() || ( is_object( $file ) && !$file->isLocal() ) ) { |
299 | | - $rarticle->setRedirectedFrom( $this->context->title ); |
| 293 | + $rarticle->setRedirectedFrom( $this->getTitle() ); |
300 | 294 | $article = $rarticle; |
301 | | - $this->context->title = $target; |
| 295 | + $this->getContext()->setTitle( $target ); |
302 | 296 | } |
303 | 297 | } |
304 | 298 | } else { |
305 | | - $this->context->title = $article->getTitle(); |
| 299 | + $this->getContext()->setTitle( $article->getTitle() ); |
306 | 300 | } |
307 | 301 | } |
308 | 302 | wfProfileOut( __METHOD__ ); |
— | — | @@ -318,7 +312,7 @@ |
319 | 313 | $factory = wfGetLBFactory(); |
320 | 314 | $factory->commitMasterChanges(); |
321 | 315 | // Output everything! |
322 | | - $this->context->output->output(); |
| 316 | + $this->getOutput()->output(); |
323 | 317 | // Do any deferred jobs |
324 | 318 | wfDoUpdates( 'commit' ); |
325 | 319 | |
— | — | @@ -397,8 +391,8 @@ |
398 | 392 | wfProfileIn( __METHOD__ ); |
399 | 393 | |
400 | 394 | 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 ) ) ) |
403 | 397 | { |
404 | 398 | wfProfileOut( __METHOD__ ); |
405 | 399 | return; |
— | — | @@ -415,7 +409,7 @@ |
416 | 410 | |
417 | 411 | switch( $act ) { |
418 | 412 | case 'view': |
419 | | - $this->context->output->setSquidMaxage( $wgSquidMaxage ); |
| 413 | + $this->getOutput()->setSquidMaxage( $wgSquidMaxage ); |
420 | 414 | $article->view(); |
421 | 415 | break; |
422 | 416 | case 'raw': // includes JS/CSS |
— | — | @@ -442,25 +436,25 @@ |
443 | 437 | } |
444 | 438 | // Continue... |
445 | 439 | 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' ); |
451 | 445 | if ( !$wgUseExternalEditor || $act == 'submit' || $internal || |
452 | | - $section || $oldid || ( !$this->context->user->getOption( 'externaleditor' ) && !$external ) ) { |
| 446 | + $section || $oldid || ( !$this->getUser()->getOption( 'externaleditor' ) && !$external ) ) { |
453 | 447 | $editor = new EditPage( $article ); |
454 | 448 | $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' ); |
457 | 451 | $extedit = new ExternalEdit( $article, $mode ); |
458 | 452 | $extedit->edit(); |
459 | 453 | } |
460 | 454 | } |
461 | 455 | break; |
462 | 456 | 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 ); |
465 | 459 | } |
466 | 460 | $history = new HistoryPage( $article ); |
467 | 461 | $history->history(); |
— | — | @@ -472,7 +466,7 @@ |
473 | 467 | break; |
474 | 468 | default: |
475 | 469 | if ( wfRunHooks( 'UnknownAction', array( $act, $article ) ) ) { |
476 | | - $this->context->output->showErrorPage( 'nosuchaction', 'nosuchactiontext' ); |
| 470 | + $this->getOutput()->showErrorPage( 'nosuchaction', 'nosuchactiontext' ); |
477 | 471 | } |
478 | 472 | } |
479 | 473 | wfProfileOut( __METHOD__ ); |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -839,14 +839,14 @@ |
840 | 840 | // Redirect to a page title with possible query parameters |
841 | 841 | if ( $redirect instanceof Title ) { |
842 | 842 | $url = $redirect->getFullUrl( $query ); |
843 | | - $this->getContext()->output->redirect( $url ); |
| 843 | + $this->getOutput()->redirect( $url ); |
844 | 844 | wfProfileOut( __METHOD__ ); |
845 | 845 | return $redirect; |
846 | 846 | // Redirect to index.php with query parameters |
847 | 847 | } elseif ( $redirect === true ) { |
848 | 848 | global $wgScript; |
849 | 849 | $url = $wgScript . '?' . wfArrayToCGI( $query ); |
850 | | - $this->getContext()->output->redirect( $url ); |
| 850 | + $this->getOutput()->redirect( $url ); |
851 | 851 | wfProfileOut( __METHOD__ ); |
852 | 852 | return $redirect; |
853 | 853 | } else { |
Index: trunk/phase3/index.php |
— | — | @@ -130,14 +130,14 @@ |
131 | 131 | $cache = new HTMLFileCache( $wgTitle, $action ); |
132 | 132 | if ( $cache->isFileCacheGood( /* Assume up to date */ ) ) { |
133 | 133 | /* Check incoming headers to see if client has this cached */ |
134 | | - if ( !$context->output->checkLastModified( $cache->fileCacheTime() ) ) { |
| 134 | + if ( !$context->getOutput()->checkLastModified( $cache->fileCacheTime() ) ) { |
135 | 135 | $cache->loadFromFileCache(); |
136 | 136 | } |
137 | 137 | # Do any stats increment/watchlist stuff |
138 | 138 | $article = Article::newFromTitle( $wgTitle, $context ); |
139 | 139 | $article->viewUpdates(); |
140 | 140 | # Tell OutputPage that output is taken care of |
141 | | - $context->output->disable(); |
| 141 | + $context->getOutput()->disable(); |
142 | 142 | wfProfileOut( 'index.php-filecache' ); |
143 | 143 | $mediaWiki->finalCleanup(); |
144 | 144 | wfProfileOut( 'index.php' ); |