r85250 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85249‎ | r85250 | r85251 >
Date:12:46, 3 April 2011
Author:dantman
Status:resolved (Comments)
Tags:
Comment:
Continue with r85240; Move getSkin from User to RequestContext, do it without globals, strip out the non-functional $title related stuff, and update Skin to use a RequestContext.
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/RequestContext.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -2295,48 +2295,15 @@
22962296 }
22972297
22982298 /**
2299 - * Get the current skin, loading it if required, and setting a title
2300 - * @param $t Title: the title to use in the skin
 2299+ * Get the current skin, loading it if required
23012300 * @return Skin The current skin
23022301 * @todo: FIXME : need to check the old failback system [AV]
 2302+ * @deprecated Use ->getSkin() in the most relevant outputting context you have
23032303 */
2304 - function getSkin( $t = null ) {
2305 - if( !$this->mSkin ) {
2306 - global $wgOut;
2307 - $this->mSkin = $this->createSkinObject();
2308 - $this->mSkin->setTitle( $wgOut->getTitle() );
2309 - }
2310 - if ( $t && ( !$this->mSkin->getTitle() || !$t->equals( $this->mSkin->getTitle() ) ) ) {
2311 - $skin = $this->createSkinObject();
2312 - $skin->setTitle( $t );
2313 - return $skin;
2314 - } else {
2315 - return $this->mSkin;
2316 - }
 2304+ function getSkin() {
 2305+ return RequestContext::getMain()->getSkin();
23172306 }
23182307
2319 - // Creates a Skin object, for getSkin()
2320 - private function createSkinObject() {
2321 - wfProfileIn( __METHOD__ );
2322 -
2323 - global $wgHiddenPrefs;
2324 - if( !in_array( 'skin', $wgHiddenPrefs ) ) {
2325 - global $wgRequest;
2326 - # get the user skin
2327 - $userSkin = $this->getOption( 'skin' );
2328 - $userSkin = $wgRequest->getVal( 'useskin', $userSkin );
2329 - } else {
2330 - # if we're not allowing users to override, then use the default
2331 - global $wgDefaultSkin;
2332 - $userSkin = $wgDefaultSkin;
2333 - }
2334 -
2335 - $skin = Skin::newFromKey( $userSkin );
2336 - wfProfileOut( __METHOD__ );
2337 -
2338 - return $skin;
2339 - }
2340 -
23412308 /**
23422309 * Check the watched status of an article.
23432310 * @param $title Title of the article to look at
Index: trunk/phase3/includes/RequestContext.php
@@ -130,9 +130,25 @@
131131 * @return Skin
132132 */
133133 public function getSkin() {
134 - // For now we'll just proxy to the user. In the future a saner location for
135 - // organizing what skin to use may be chosen
136 - return $this->getUser()->getSkin();
 134+ if ( !isset($this->skin) ) {
 135+ wfProfileIn( __METHOD__ . '-createskin' );
 136+
 137+ global $wgHiddenPrefs;
 138+ if( !in_array( 'skin', $wgHiddenPrefs ) ) {
 139+ # get the user skin
 140+ $userSkin = $this->getUser()->getOption( 'skin' );
 141+ $userSkin = $this->getRequest()->getVal( 'useskin', $userSkin );
 142+ } else {
 143+ # if we're not allowing users to override, then use the default
 144+ global $wgDefaultSkin;
 145+ $userSkin = $wgDefaultSkin;
 146+ }
 147+
 148+ $this->skin = Skin::newFromKey( $userSkin );
 149+ $this->skin->setContext( $this );
 150+ wfProfileOut( __METHOD__ . '-createskin' );
 151+ }
 152+ return $this->skin;
137153 }
138154
139155 /** Helpful methods **/
Index: trunk/phase3/includes/OutputPage.php
@@ -552,7 +552,7 @@
553553 * @return Boolean: true iff cache-ok headers was sent.
554554 */
555555 public function checkLastModified( $timestamp ) {
556 - global $wgCachePages, $wgCacheEpoch, $wgRequest;
 556+ global $wgCachePages, $wgCacheEpoch;
557557
558558 if ( !$timestamp || $timestamp == '19700101000000' ) {
559559 wfDebug( __METHOD__ . ": CACHE DISABLED, NO TIMESTAMP\n" );
@@ -619,7 +619,7 @@
620620 # Give a 304 response code and disable body output
621621 wfDebug( __METHOD__ . ": NOT MODIFIED, $info\n", false );
622622 ini_set( 'zlib.output_compression', 0 );
623 - $wgRequest->response()->header( "HTTP/1.1 304 Not Modified" );
 623+ $this->getRequest()->response()->header( "HTTP/1.1 304 Not Modified" );
624624 $this->sendCacheControl();
625625 $this->disable();
626626
@@ -774,6 +774,16 @@
775775 }
776776
777777 /**
 778+ * Get the WebRequest being used for this instance
 779+ *
 780+ * @return WebRequest
 781+ * @since 1.18
 782+ */
 783+ public function getRequest() {
 784+ return $this->getContext()->getRequest();
 785+ }
 786+
 787+ /**
778788 * Set the Title object to use
779789 *
780790 * @param $t Title object
@@ -1546,9 +1556,9 @@
15471557 * @return Boolean
15481558 */
15491559 function uncacheableBecauseRequestVars() {
1550 - global $wgRequest;
1551 - return $wgRequest->getText( 'useskin', false ) === false
1552 - && $wgRequest->getText( 'uselang', false ) === false;
 1560+ $request = $this->getRequest();
 1561+ return $request->getText( 'useskin', false ) === false
 1562+ && $request->getText( 'uselang', false ) === false;
15531563 }
15541564
15551565 /**
@@ -1558,8 +1568,7 @@
15591569 * @return Boolean
15601570 */
15611571 function haveCacheVaryCookies() {
1562 - global $wgRequest;
1563 - $cookieHeader = $wgRequest->getHeader( 'cookie' );
 1572+ $cookieHeader = $this->getRequest()->getHeader( 'cookie' );
15641573 if ( $cookieHeader === false ) {
15651574 return false;
15661575 }
@@ -1632,8 +1641,8 @@
16331642 * /w/index.php?title=Main_page&variant=zh-cn should never be served.
16341643 */
16351644 function addAcceptLanguage() {
1636 - global $wgRequest, $wgContLang;
1637 - if( !$wgRequest->getCheck( 'variant' ) && $wgContLang->hasVariants() ) {
 1645+ global $wgContLang;
 1646+ if( !$this->getRequest()->getCheck( 'variant' ) && $wgContLang->hasVariants() ) {
16381647 $variants = $wgContLang->getVariants();
16391648 $aloption = array();
16401649 foreach ( $variants as $variant ) {
@@ -1696,9 +1705,9 @@
16971706 * Send cache control HTTP headers
16981707 */
16991708 public function sendCacheControl() {
1700 - global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgRequest, $wgUseXVO;
 1709+ global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgUseXVO;
17011710
1702 - $response = $wgRequest->response();
 1711+ $response = $this->getRequest()->response();
17031712 if ( $wgUseETag && $this->mETag ) {
17041713 $response->header( "ETag: $this->mETag" );
17051714 }
@@ -1824,7 +1833,7 @@
18251834 * the object, let's actually output it:
18261835 */
18271836 public function output() {
1828 - global $wgOutputEncoding, $wgRequest;
 1837+ global $wgOutputEncoding;
18291838 global $wgLanguageCode, $wgDebugRedirects, $wgMimeType;
18301839
18311840 if( $this->mDoNothing ) {
@@ -1833,7 +1842,7 @@
18341843
18351844 wfProfileIn( __METHOD__ );
18361845
1837 - $response = $wgRequest->response();
 1846+ $response = $this->getRequest()->response();
18381847
18391848 if ( $this->mRedirect != '' ) {
18401849 # Standards require redirect URLs to be absolute
@@ -1924,7 +1933,7 @@
19251934 * @return nothing
19261935 */
19271936 function blockedPage( $return = true ) {
1928 - global $wgContLang, $wgLang;
 1937+ global $wgContLang;
19291938
19301939 $this->setPageTitle( wfMsg( 'blockedtitle' ) );
19311940 $this->setRobotPolicy( 'noindex,nofollow' );
@@ -1935,7 +1944,7 @@
19361945 if( $reason == '' ) {
19371946 $reason = wfMsg( 'blockednoreason' );
19381947 }
1939 - $blockTimestamp = $wgLang->timeanddate(
 1948+ $blockTimestamp = $this->getContext()->getLang()->timeanddate(
19401949 wfTimestamp( TS_MW, $this->getUser()->mBlock->mTimestamp ), true
19411950 );
19421951 $ip = wfGetIP();
@@ -1944,7 +1953,7 @@
19451954
19461955 $blockid = $this->getUser()->mBlock->getId();
19471956
1948 - $blockExpiry = $wgLang->formatExpiry( $this->getUser()->mBlock->mExpiry );
 1957+ $blockExpiry = $this->getContext()->getLang()->formatExpiry( $this->getUser()->mBlock->mExpiry );
19491958
19501959 if ( $this->getUser()->mBlock->mAuto ) {
19511960 $msg = 'autoblockedtext';
@@ -2034,8 +2043,6 @@
20352044 * @param $permission String: key required
20362045 */
20372046 public function permissionRequired( $permission ) {
2038 - global $wgLang;
2039 -
20402047 $this->setPageTitle( wfMsg( 'badaccess' ) );
20412048 $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) );
20422049 $this->setRobotPolicy( 'noindex,nofollow' );
@@ -2047,7 +2054,7 @@
20482055 if( $groups ) {
20492056 $this->addWikiMsg(
20502057 'badaccess-groups',
2051 - $wgLang->commaList( $groups ),
 2058+ $this->getContext()->getLang()->commaList( $groups ),
20522059 count( $groups )
20532060 );
20542061 } else {
@@ -2279,14 +2286,12 @@
22802287 * @param $returntoquery String: query string for the return to link
22812288 */
22822289 public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) {
2283 - global $wgRequest;
2284 -
22852290 if ( $returnto == null ) {
2286 - $returnto = $wgRequest->getText( 'returnto' );
 2291+ $returnto = $this->getRequest()->getText( 'returnto' );
22872292 }
22882293
22892294 if ( $returntoquery == null ) {
2290 - $returntoquery = $wgRequest->getText( 'returntoquery' );
 2295+ $returntoquery = $this->getRequest()->getText( 'returntoquery' );
22912296 }
22922297
22932298 if ( $returnto === '' ) {
@@ -2313,7 +2318,6 @@
23142319 public function headElement( Skin $sk, $includeStyle = true ) {
23152320 global $wgOutputEncoding, $wgMimeType;
23162321 global $wgUseTrackbacks, $wgHtml5;
2317 - global $wgRequest, $wgLang;
23182322
23192323 if ( $sk->commonPrintStylesheet() ) {
23202324 $this->addModuleStyles( 'mediawiki.legacy.wikiprintable' );
@@ -2353,7 +2357,7 @@
23542358 $bodyAttrs = array();
23552359
23562360 # Crazy edit-on-double-click stuff
2357 - $action = $wgRequest->getVal( 'action', 'view' );
 2361+ $action = $this->getRequest()->getVal( 'action', 'view' );
23582362
23592363 if (
23602364 $this->getTitle()->getNamespace() != NS_SPECIAL &&
@@ -2368,7 +2372,7 @@
23692373 $dir = wfUILang()->getDir();
23702374 $bodyAttrs['class'] = "mediawiki $dir";
23712375
2372 - if ( $wgLang->capitalizeAllNouns() ) {
 2376+ if ( $this->getContext()->getLang()->capitalizeAllNouns() ) {
23732377 # A <body> class is probably not the best way to do this . . .
23742378 $bodyAttrs['class'] .= ' capitalize-all-nouns';
23752379 }
@@ -2437,13 +2441,13 @@
24382442 * @return string html <script> and <style> tags
24392443 */
24402444 protected function makeResourceLoaderLink( Skin $skin, $modules, $only, $useESI = false ) {
2441 - global $wgLang, $wgLoadScript, $wgResourceLoaderUseESI,
2442 - $wgResourceLoaderInlinePrivateModules, $wgRequest;
 2445+ global $wgLoadScript, $wgResourceLoaderUseESI,
 2446+ $wgResourceLoaderInlinePrivateModules;
24432447 // Lazy-load ResourceLoader
24442448 // TODO: Should this be a static function of ResourceLoader instead?
24452449 // TODO: Divide off modules starting with "user", and add the user parameter to them
24462450 $baseQuery = array(
2447 - 'lang' => $wgLang->getCode(),
 2451+ 'lang' => $this->getContext()->getLang()->getCode(),
24482452 'debug' => ResourceLoader::inDebugMode() ? 'true' : 'false',
24492453 'skin' => $skin->getSkinName(),
24502454 'only' => $only,
@@ -2452,7 +2456,7 @@
24532457 if ( $this->isPrintable() ) {
24542458 $baseQuery['printable'] = 1;
24552459 }
2456 - if ( $wgRequest->getBool( 'handheld' ) ) {
 2460+ if ( $this->getRequest()->getBool( 'handheld' ) ) {
24572461 $baseQuery['handheld'] = 1;
24582462 }
24592463
@@ -2589,7 +2593,7 @@
25902594 * @return String: HTML fragment
25912595 */
25922596 function getHeadScripts( Skin $sk ) {
2593 - global $wgRequest, $wgUseSiteJs, $wgAllowUserJs;
 2597+ global $wgUseSiteJs, $wgAllowUserJs;
25942598
25952599 // Startup - this will immediately load jquery and mediawiki modules
25962600 $scripts = $this->makeResourceLoaderLink( $sk, 'startup', ResourceLoaderModule::TYPE_SCRIPTS, true );
@@ -2626,10 +2630,10 @@
26272631
26282632 // Add user JS if enabled
26292633 if ( $wgAllowUserJs && $this->getUser()->isLoggedIn() ) {
2630 - $action = $wgRequest->getVal( 'action', 'view' );
 2634+ $action = $this->getRequest()->getVal( 'action', 'view' );
26312635 if( $this->getTitle() && $this->getTitle()->isJsSubpage() && $sk->userCanPreview( $action ) ) {
26322636 # XXX: additional security check/prompt?
2633 - $scripts .= Html::inlineScript( "\n" . $wgRequest->getText( 'wpTextbox1' ) . "\n" ) . "\n";
 2637+ $scripts .= Html::inlineScript( "\n" . $this->getRequest()->getText( 'wpTextbox1' ) . "\n" ) . "\n";
26342638 } else {
26352639 # FIXME: this means that User:Me/Common.js doesn't load when previewing
26362640 # User:Me/Vector.js, and vice versa (bug26283)
@@ -2650,7 +2654,7 @@
26512655 * have to be purged on configuration changes.
26522656 */
26532657 protected function getJSVars() {
2654 - global $wgRequest, $wgUseAjax, $wgEnableMWSuggest, $wgContLang;
 2658+ global $wgUseAjax, $wgEnableMWSuggest, $wgContLang;
26552659
26562660 $title = $this->getTitle();
26572661 $ns = $title->getNamespace();
@@ -2671,7 +2675,7 @@
26722676 'wgCurRevisionId' => $title->getLatestRevID(),
26732677 'wgArticleId' => $title->getArticleId(),
26742678 'wgIsArticle' => $this->isArticle(),
2675 - 'wgAction' => $wgRequest->getText( 'action', 'view' ),
 2679+ 'wgAction' => $this->getRequest()->getText( 'action', 'view' ),
26762680 'wgUserName' => $this->getUser()->isAnon() ? null : $this->getUser()->getName(),
26772681 'wgUserGroups' => $this->getUser()->getEffectiveGroups(),
26782682 'wgCategories' => $this->getCategories(),
@@ -3094,7 +3098,7 @@
30953099 * @return String: modified value of the "media" attribute
30963100 */
30973101 public static function transformCssMedia( $media ) {
3098 - global $wgRequest, $wgHandheldForIPhone;
 3102+ global $wgHandheldForIPhone;
30993103
31003104 // Switch in on-screen display for media testing
31013105 $switches = array(
@@ -3102,7 +3106,7 @@
31033107 'handheld' => 'handheld',
31043108 );
31053109 foreach( $switches as $switch => $targetMedia ) {
3106 - if( $wgRequest->getBool( $switch ) ) {
 3110+ if( $this->getRequest()->getBool( $switch ) ) {
31073111 if( $media == $targetMedia ) {
31083112 $media = '';
31093113 } elseif( $media == 'screen' ) {
@@ -3153,13 +3157,13 @@
31543158 * @param $lag Integer: slave lag
31553159 */
31563160 public function showLagWarning( $lag ) {
3157 - global $wgSlaveLagWarning, $wgSlaveLagCritical, $wgLang;
 3161+ global $wgSlaveLagWarning, $wgSlaveLagCritical;
31583162 if( $lag >= $wgSlaveLagWarning ) {
31593163 $message = $lag < $wgSlaveLagCritical
31603164 ? 'lag-warn-normal'
31613165 : 'lag-warn-high';
31623166 $wrap = Html::rawElement( 'div', array( 'class' => "mw-{$message}" ), "\n$1\n" );
3163 - $this->wrapWikiMsg( "$wrap\n", array( $message, $wgLang->formatNum( $lag ) ) );
 3167+ $this->wrapWikiMsg( "$wrap\n", array( $message, $this->getContext()->getLang()->formatNum( $lag ) ) );
31643168 }
31653169 }
31663170
Index: trunk/phase3/includes/SkinTemplate.php
@@ -158,8 +158,8 @@
159159 wfProfileOut( __METHOD__ . '-init' );
160160
161161 wfProfileIn( __METHOD__ . '-stuff' );
162 - $this->thispage = $this->mTitle->getPrefixedDBkey();
163 - $this->thisurl = $this->mTitle->getPrefixedURL();
 162+ $this->thispage = $this->getTitle()->getPrefixedDBkey();
 163+ $this->thisurl = $this->getTitle()->getPrefixedURL();
164164 $query = array();
165165 if ( !$wgRequest->wasPosted() ) {
166166 $query = $wgRequest->getValues();
@@ -169,7 +169,7 @@
170170 }
171171 $this->thisquery = wfUrlencode( wfArrayToCGI( $query ) );
172172 $this->loggedin = $wgUser->isLoggedIn();
173 - $this->iscontent = ( $this->mTitle->getNamespace() != NS_SPECIAL );
 173+ $this->iscontent = ( $this->getTitle()->getNamespace() != NS_SPECIAL );
174174 $this->iseditable = ( $this->iscontent and !( $action == 'edit' or $action == 'submit' ) );
175175 $this->username = $wgUser->getName();
176176
@@ -181,7 +181,7 @@
182182 $this->userpageUrlDetails = self::makeKnownUrlDetails( $this->userpage );
183183 }
184184
185 - $this->titletxt = $this->mTitle->getPrefixedText();
 185+ $this->titletxt = $this->getTitle()->getPrefixedText();
186186 wfProfileOut( __METHOD__ . '-stuff' );
187187
188188 wfProfileIn( __METHOD__ . '-stuff-head' );
@@ -230,19 +230,19 @@
231231 $tpl->set( 'title', $out->getPageTitle() );
232232 $tpl->set( 'pagetitle', $out->getHTMLTitle() );
233233 $tpl->set( 'displaytitle', $out->mPageLinkTitle );
234 - $tpl->set( 'pageclass', $this->getPageClasses( $this->mTitle ) );
 234+ $tpl->set( 'pageclass', $this->getPageClasses( $this->getTitle() ) );
235235 $tpl->set( 'skinnameclass', ( 'skin-' . Sanitizer::escapeClass( $this->getSkinName() ) ) );
236236
237 - $nsname = MWNamespace::exists( $this->mTitle->getNamespace() ) ?
238 - MWNamespace::getCanonicalName( $this->mTitle->getNamespace() ) :
239 - $this->mTitle->getNsText();
 237+ $nsname = MWNamespace::exists( $this->getTitle()->getNamespace() ) ?
 238+ MWNamespace::getCanonicalName( $this->getTitle()->getNamespace() ) :
 239+ $this->getTitle()->getNsText();
240240
241241 $tpl->set( 'nscanonical', $nsname );
242 - $tpl->set( 'nsnumber', $this->mTitle->getNamespace() );
243 - $tpl->set( 'titleprefixeddbkey', $this->mTitle->getPrefixedDBKey() );
244 - $tpl->set( 'titletext', $this->mTitle->getText() );
245 - $tpl->set( 'articleid', $this->mTitle->getArticleId() );
246 - $tpl->set( 'currevisionid', $this->mTitle->getLatestRevID() );
 242+ $tpl->set( 'nsnumber', $this->getTitle()->getNamespace() );
 243+ $tpl->set( 'titleprefixeddbkey', $this->getTitle()->getPrefixedDBKey() );
 244+ $tpl->set( 'titletext', $this->getTitle()->getText() );
 245+ $tpl->set( 'articleid', $this->getTitle()->getArticleId() );
 246+ $tpl->set( 'currevisionid', $this->getTitle()->getLatestRevID() );
247247
248248 $tpl->set( 'isarticle', $out->isArticle() );
249249
@@ -284,12 +284,12 @@
285285 $tpl->set( 'printable', $out->isPrintable() );
286286 $tpl->set( 'handheld', $wgRequest->getBool( 'handheld' ) );
287287 $tpl->setRef( 'loggedin', $this->loggedin );
288 - $tpl->set( 'notspecialpage', $this->mTitle->getNamespace() != NS_SPECIAL );
 288+ $tpl->set( 'notspecialpage', $this->getTitle()->getNamespace() != NS_SPECIAL );
289289 /* XXX currently unused, might get useful later
290 - $tpl->set( 'editable', ( $this->mTitle->getNamespace() != NS_SPECIAL ) );
291 - $tpl->set( 'exists', $this->mTitle->getArticleID() != 0 );
292 - $tpl->set( 'watch', $this->mTitle->userIsWatching() ? 'unwatch' : 'watch' );
293 - $tpl->set( 'protect', count( $this->mTitle->isProtected() ) ? 'unprotect' : 'protect' );
 290+ $tpl->set( 'editable', ( $this->getTitle()->getNamespace() != NS_SPECIAL ) );
 291+ $tpl->set( 'exists', $this->getTitle()->getArticleID() != 0 );
 292+ $tpl->set( 'watch', $this->getTitle()->userIsWatching() ? 'unwatch' : 'watch' );
 293+ $tpl->set( 'protect', count( $this->getTitle()->isProtected() ) ? 'unprotect' : 'protect' );
294294 $tpl->set( 'helppage', wfMsg( 'helppage' ) );
295295 */
296296 $tpl->set( 'searchaction', $this->escapeSearchLink() );
@@ -328,7 +328,7 @@
329329
330330 // The content of SpecialPages should be presented in the
331331 // user's language. Content of regular pages should not be touched.
332 - if( $this->mTitle->isSpecialPage() ) {
 332+ if( $this->getTitle()->isSpecialPage() ) {
333333 $tpl->set( 'specialpageattributes', $attrs );
334334 }
335335 }
@@ -342,9 +342,9 @@
343343 $tpl->setRef( 'skin', $this );
344344 $tpl->set( 'logo', $this->logoText() );
345345 if ( $out->isArticle() && ( !isset( $oldid ) || isset( $diff ) ) &&
346 - $this->mTitle->exists() )
 346+ $this->getTitle()->exists() )
347347 {
348 - $article = new Article( $this->mTitle, 0 );
 348+ $article = new Article( $this->getTitle(), 0 );
349349 if ( !$wgDisableCounters ) {
350350 $viewcount = $wgLang->formatNum( $article->getCount() );
351351 if ( $viewcount ) {
@@ -360,7 +360,7 @@
361361 $dbr = wfGetDB( DB_SLAVE );
362362 $res = $dbr->select( 'watchlist',
363363 array( 'COUNT(*) AS n' ),
364 - array( 'wl_title' => $dbr->strencode( $this->mTitle->getDBkey() ), 'wl_namespace' => $this->mTitle->getNamespace() ),
 364+ array( 'wl_title' => $dbr->strencode( $this->getTitle()->getDBkey() ), 'wl_namespace' => $this->getTitle()->getNamespace() ),
365365 __METHOD__
366366 );
367367 $x = $dbr->fetchObject( $res );
@@ -796,7 +796,7 @@
797797 wfProfileIn( __METHOD__ );
798798
799799 $title = $this->getRelevantTitle(); // Display tabs for the relevant title rather than always the title itself
800 - $onPage = $title->equals($this->mTitle);
 800+ $onPage = $title->equals($this->getTitle());
801801
802802 $content_navigation = array(
803803 'namespaces' => array(),
@@ -935,7 +935,7 @@
936936 if ( $title->quickUserCan( 'move' ) ) {
937937 $moveTitle = SpecialPage::getTitleFor( 'Movepage', $title->getPrefixedDBkey() );
938938 $content_navigation['actions']['move'] = array(
939 - 'class' => $this->mTitle->isSpecial( 'Movepage' ) ? 'selected' : false,
 939+ 'class' => $this->getTitle()->isSpecial( 'Movepage' ) ? 'selected' : false,
940940 'text' => wfMessageFallback( "$skname-action-move", 'move' )->text(),
941941 'href' => $moveTitle->getLocalURL()
942942 );
@@ -958,7 +958,7 @@
959959 // If the user can't undelete but can view deleted history show them a "View .. deleted" tab instead
960960 $msgKey = $wgUser->isAllowed( 'undelete' ) ? 'undelete' : 'viewdeleted';
961961 $content_navigation['actions']['undelete'] = array(
962 - 'class' => $this->mTitle->isSpecial( 'Undelete' ) ? 'selected' : false,
 962+ 'class' => $this->getTitle()->isSpecial( 'Undelete' ) ? 'selected' : false,
963963 'text' => wfMessageFallback( "$skname-action-$msgKey", "{$msgKey}_short" )
964964 ->params( $wgLang->formatNum( $n ) )->text(),
965965 'href' => $undelTitle->getLocalURL( array( 'target' => $title->getPrefixedDBkey() ) )
@@ -1157,7 +1157,7 @@
11581158 if ( !$out->isPrintable() ) {
11591159 $nav_urls['print'] = array(
11601160 'text' => wfMsg( 'printableversion' ),
1161 - 'href' => $this->mTitle->getLocalURL( $wgRequest->appendQueryValue( 'printable', 'yes', true ) )
 1161+ 'href' => $this->getTitle()->getLocalURL( $wgRequest->appendQueryValue( 'printable', 'yes', true ) )
11621162 );
11631163 }
11641164
@@ -1174,12 +1174,12 @@
11751175 wfRunHooks( 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', array( &$this, &$nav_urls, &$revid, &$revid ) );
11761176 }
11771177
1178 - if( $this->mTitle->getNamespace() != NS_SPECIAL ) {
 1178+ if( $this->getTitle()->getNamespace() != NS_SPECIAL ) {
11791179 $wlhTitle = SpecialPage::getTitleFor( 'Whatlinkshere', $this->thispage );
11801180 $nav_urls['whatlinkshere'] = array(
11811181 'href' => $wlhTitle->getLocalUrl()
11821182 );
1183 - if( $this->mTitle->getArticleId() ) {
 1183+ if( $this->getTitle()->getArticleId() ) {
11841184 $rclTitle = SpecialPage::getTitleFor( 'Recentchangeslinked', $this->thispage );
11851185 $nav_urls['recentchangeslinked'] = array(
11861186 'href' => $rclTitle->getLocalUrl()
@@ -1249,7 +1249,7 @@
12501250 * @private
12511251 */
12521252 function getNameSpaceKey() {
1253 - return $this->mTitle->getNamespaceKey();
 1253+ return $this->getTitle()->getNamespaceKey();
12541254 }
12551255
12561256 /**
@@ -1263,7 +1263,7 @@
12641264 $action = $wgRequest->getVal( 'action', 'view' );
12651265
12661266 if( $allowUserJs && $this->loggedin ) {
1267 - if( $this->mTitle->isJsSubpage() and $this->userCanPreview( $action ) ) {
 1267+ if( $this->getTitle()->isJsSubpage() and $this->userCanPreview( $action ) ) {
12681268 # XXX: additional security check/prompt?
12691269 $this->userjsprev = '/*<![CDATA[*/ ' . $wgRequest->getText( 'wpTextbox1' ) . ' /*]]>*/';
12701270 } else {
Index: trunk/phase3/includes/Skin.php
@@ -23,11 +23,6 @@
2424 /**#@-*/
2525 protected $mRevisionId; // The revision ID we're looking at, null if not applicable.
2626 protected $skinname = 'standard';
27 - /**
28 - * todo Fixme: should be protected :-\
29 - * @var Title
30 - */
31 - var $mTitle = null;
3227 protected $mRelevantTitle = null;
3328 protected $mRelevantUser = null;
3429
@@ -191,18 +186,18 @@
192187 * Preload the existence of three commonly-requested pages in a single query
193188 */
194189 function preloadExistence() {
195 - global $wgUser;
196 -
 190+ $user = $this->getContext()->getUser();
 191+
197192 // User/talk link
198 - $titles = array( $wgUser->getUserPage(), $wgUser->getTalkPage() );
 193+ $titles = array( $user->getUserPage(), $user->getTalkPage() );
199194
200195 // Other tab link
201 - if ( $this->mTitle->getNamespace() == NS_SPECIAL ) {
 196+ if ( $this->getTitle()->getNamespace() == NS_SPECIAL ) {
202197 // nothing
203 - } elseif ( $this->mTitle->isTalkPage() ) {
204 - $titles[] = $this->mTitle->getSubjectPage();
 198+ } elseif ( $this->getTitle()->isTalkPage() ) {
 199+ $titles[] = $this->getTitle()->getSubjectPage();
205200 } else {
206 - $titles[] = $this->mTitle->getTalkPage();
 201+ $titles[] = $this->getTitle()->getTalkPage();
207202 }
208203
209204 $lb = new LinkBatch( $titles );
@@ -214,9 +209,7 @@
215210 * Set some local variables
216211 */
217212 protected function setMembers() {
218 - global $wgUser;
219 - $this->mUser = $wgUser;
220 - $this->userpage = $wgUser->getUserPage()->getPrefixedText();
 213+ $this->userpage = $this->getContext()->getUser()->getUserPage()->getPrefixedText();
221214 $this->usercss = false;
222215 }
223216
@@ -226,23 +219,37 @@
227220 * @return Boolean
228221 */
229222 public function isRevisionCurrent() {
230 - return $this->mRevisionId == 0 || $this->mRevisionId == $this->mTitle->getLatestRevID();
 223+ return $this->mRevisionId == 0 || $this->mRevisionId == $this->getTitle()->getLatestRevID();
231224 }
232225
233226 /**
234 - * Set the title
235 - * @param $t Title object to use
 227+ * Set the RequestContext used in this instance
 228+ *
 229+ * @param RequestContext $context
236230 */
237 - public function setTitle( $t ) {
238 - $this->mTitle = $t;
 231+ public function setContext( RequestContext $context ) {
 232+ $this->mContext = $context;
239233 }
240234
 235+ /**
 236+ * Get the RequestContext used in this instance
 237+ *
 238+ * @return RequestContext
 239+ */
 240+ public function getContext() {
 241+ if ( !isset($this->mContext) ) {
 242+ wfDebug( __METHOD__ . " called and \$mContext is null. Using RequestContext::getMain(); for sanity\n" );
 243+ $this->mContext = RequestContext::getMain();
 244+ }
 245+ return $this->mContext;
 246+ }
 247+
241248 /** Get the title
242249 *
243250 * @return Title
244251 */
245252 public function getTitle() {
246 - return $this->mTitle;
 253+ return $this->getContext()->getTitle();
247254 }
248255
249256 /**
@@ -266,7 +273,7 @@
267274 if ( isset($this->mRelevantTitle) ) {
268275 return $this->mRelevantTitle;
269276 }
270 - return $this->mTitle;
 277+ return $this->getTitle();
271278 }
272279
273280 /**
@@ -363,23 +370,21 @@
364371 * @return bool
365372 */
366373 public function userCanPreview( $action ) {
367 - global $wgRequest, $wgUser;
368 -
369374 if ( $action != 'submit' ) {
370375 return false;
371376 }
372 - if ( !$wgRequest->wasPosted() ) {
 377+ if ( !$this->getContext()->getRequest()->wasPosted() ) {
373378 return false;
374379 }
375 - if ( !$this->mTitle->userCanEditCssSubpage() ) {
 380+ if ( !$this->getTitle()->userCanEditCssSubpage() ) {
376381 return false;
377382 }
378 - if ( !$this->mTitle->userCanEditJsSubpage() ) {
 383+ if ( !$this->getTitle()->userCanEditJsSubpage() ) {
379384 return false;
380385 }
381386
382 - return $wgUser->matchEditToken(
383 - $wgRequest->getVal( 'wpEditToken' ) );
 387+ return $this->getContext()->getUser()->matchEditToken(
 388+ $this->getContext()->getRequest()->getVal( 'wpEditToken' ) );
384389 }
385390
386391 /**
@@ -428,7 +433,6 @@
429434 * @private
430435 */
431436 function setupUserCss( OutputPage $out ) {
432 - global $wgRequest, $wgUser;
433437 global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs;
434438
435439 wfProfileIn( __METHOD__ );
@@ -442,16 +446,16 @@
443447 // Per-site custom styles
444448 if ( $wgUseSiteCss ) {
445449 $out->addModuleStyles( array( 'site', 'noscript' ) );
446 - if( $wgUser->isLoggedIn() ){
 450+ if( $this->getContext()->getUser()->isLoggedIn() ){
447451 $out->addModuleStyles( 'user.groups' );
448452 }
449453 }
450454
451455 // Per-user custom styles
452456 if ( $wgAllowUserCss ) {
453 - if ( $this->mTitle->isCssSubpage() && $this->userCanPreview( $wgRequest->getVal( 'action' ) ) ) {
 457+ if ( $this->getTitle()->isCssSubpage() && $this->userCanPreview( $this->getContext()->getRequest()->getVal( 'action' ) ) ) {
454458 // @FIXME: properly escape the cdata!
455 - $out->addInlineStyle( $wgRequest->getText( 'wpTextbox1' ) );
 459+ $out->addInlineStyle( $this->getContext()->getRequest()->getText( 'wpTextbox1' ) );
456460 } else {
457461 $out->addModuleStyles( 'user' );
458462 }
@@ -533,14 +537,8 @@
534538 * The format without an explicit $out argument is deprecated
535539 */
536540 function getCategoryLinks( OutputPage $out=null ) {
537 - global $wgUseCategoryBrowser, $wgContLang, $wgUser;
 541+ global $wgUseCategoryBrowser, $wgContLang;
538542
539 - if ( is_null( $out ) ) {
540 - // Backwards compatibility for when there was no $out arg
541 - global $wgOut;
542 - $out = $wgOut;
543 - }
544 -
545543 if ( count( $out->mCategoryLinks ) == 0 ) {
546544 return '';
547545 }
@@ -569,9 +567,9 @@
570568
571569 # Hidden categories
572570 if ( isset( $allCats['hidden'] ) ) {
573 - if ( $wgUser->getBoolOption( 'showhiddencats' ) ) {
 571+ if ( $this->getContext()->getUser()->getBoolOption( 'showhiddencats' ) ) {
574572 $class = 'mw-hidden-cats-user-shown';
575 - } elseif ( $this->mTitle->getNamespace() == NS_CATEGORY ) {
 573+ } elseif ( $this->getTitle()->getNamespace() == NS_CATEGORY ) {
576574 $class = 'mw-hidden-cats-ns-shown';
577575 } else {
578576 $class = 'mw-hidden-cats-hidden';
@@ -589,7 +587,7 @@
590588 $s .= '<br /><hr />';
591589
592590 # get a big array of the parents tree
593 - $parenttree = $this->mTitle->getParentCategoryTree();
 591+ $parenttree = $this->getTitle()->getParentCategoryTree();
594592 # Skin object passed by reference cause it can not be
595593 # accessed under the method subfunction drawCategoryBrowser
596594 $tempout = explode( "\n", $this->drawCategoryBrowser( $parenttree, $this ) );
@@ -634,22 +632,15 @@
635633 * the ->getCategories( $out ) form with whatout OutputPage is on hand
636634 */
637635 function getCategories( OutputPage $out=null ) {
638 - if ( is_null( $out ) ) {
639 - // Backwards compatibility for when there was no $out arg
640 - global $wgOut;
641 - $out = $wgOut;
642 - }
643636
644637 $catlinks = $this->getCategoryLinks( $out );
645638
646639 $classes = 'catlinks';
647640
648 - global $wgUser;
649 -
650641 // Check what we're showing
651642 $allCats = $out->getCategoryLinks();
652 - $showHidden = $wgUser->getBoolOption( 'showhiddencats' ) ||
653 - $this->mTitle->getNamespace() == NS_CATEGORY;
 643+ $showHidden = $this->getContext()->getUser()->getBoolOption( 'showhiddencats' ) ||
 644+ $this->getTitle()->getNamespace() == NS_CATEGORY;
654645
655646 if ( empty( $allCats['normal'] ) && !( !empty( $allCats['hidden'] ) && $showHidden ) ) {
656647 $classes .= ' catlinks-allhidden';
@@ -774,21 +765,19 @@
775766
776767 /** @return string Retrievied from HTML text */
777768 function printSource() {
778 - $url = htmlspecialchars( $this->mTitle->getFullURL() );
 769+ $url = htmlspecialchars( $this->getTitle()->getFullURL() );
779770 return wfMsg( 'retrievedfrom', '<a href="' . $url . '">' . $url . '</a>' );
780771 }
781772
782773 function getUndeleteLink() {
783 - global $wgUser, $wgLang, $wgRequest;
 774+ $action = $this->getContext()->getRequest()->getVal( 'action', 'view' );
784775
785 - $action = $wgRequest->getVal( 'action', 'view' );
 776+ if ( $this->getContext()->getUser()->isAllowed( 'deletedhistory' ) &&
 777+ ( $this->getTitle()->getArticleId() == 0 || $action == 'history' ) ) {
 778+ $n = $this->getTitle()->isDeleted();
786779
787 - if ( $wgUser->isAllowed( 'deletedhistory' ) &&
788 - ( $this->mTitle->getArticleId() == 0 || $action == 'history' ) ) {
789 - $n = $this->mTitle->isDeleted();
790 -
791780 if ( $n ) {
792 - if ( $wgUser->isAllowed( 'undelete' ) ) {
 781+ if ( $this->getContext()->getUser()->isAllowed( 'undelete' ) ) {
793782 $msg = 'thisisdeleted';
794783 } else {
795784 $msg = 'viewdeleted';
@@ -797,8 +786,8 @@
798787 return wfMsg(
799788 $msg,
800789 $this->link(
801 - SpecialPage::getTitleFor( 'Undelete', $this->mTitle->getPrefixedDBkey() ),
802 - wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $wgLang->formatNum( $n ) ),
 790+ SpecialPage::getTitleFor( 'Undelete', $this->getTitle()->getPrefixedDBkey() ),
 791+ wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $this->getContext()->getLang()->formatNum( $n ) ),
803792 array(),
804793 array(),
805794 array( 'known', 'noclasses' )
@@ -814,12 +803,7 @@
815804 * The format without an explicit $out argument is deprecated
816805 */
817806 function subPageSubtitle( OutputPage $out=null ) {
818 - if ( is_null( $out ) ) {
819 - // Backwards compatibility for when there was no $out arg
820 - global $wgOut;
821 - $out = $wgOut;
822 - }
823 -
 807+ $out = $this->getContext()->getOutput();
824808 $subpages = '';
825809
826810 if ( !wfRunHooks( 'SkinSubPageSubtitle', array( &$subpages, $this, $out ) ) ) {
@@ -827,7 +811,7 @@
828812 }
829813
830814 if ( $out->isArticle() && MWNamespace::hasSubpages( $out->getTitle()->getNamespace() ) ) {
831 - $ptext = $this->mTitle->getPrefixedText();
 815+ $ptext = $this->getTitle()->getPrefixedText();
832816 if ( preg_match( '/\//', $ptext ) ) {
833817 $links = explode( '/', $ptext );
834818 array_pop( $links );
@@ -888,10 +872,10 @@
889873 }
890874
891875 function getCopyright( $type = 'detect' ) {
892 - global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest;
 876+ global $wgRightsPage, $wgRightsUrl, $wgRightsText;
893877
894878 if ( $type == 'detect' ) {
895 - $diff = $wgRequest->getVal( 'diff' );
 879+ $diff = $this->getContext()->getRequest()->getVal( 'diff' );
896880
897881 if ( is_null( $diff ) && !$this->isRevisionCurrent() && wfMsgForContent( 'history_copyright' ) !== '-' ) {
898882 $type = 'history';
@@ -923,7 +907,7 @@
924908 // Allow for site and per-namespace customization of copyright notice.
925909 $forContent = true;
926910
927 - wfRunHooks( 'SkinCopyrightFooter', array( $this->mTitle, $type, &$msg, &$link, &$forContent ) );
 911+ wfRunHooks( 'SkinCopyrightFooter', array( $this->getTitle(), $type, &$msg, &$link, &$forContent ) );
928912
929913 if ( $forContent ) {
930914 $out .= wfMsgForContent( $msg, $link );
@@ -980,17 +964,15 @@
981965 * @return String
982966 */
983967 protected function lastModified( $article ) {
984 - global $wgLang;
985 -
986968 if ( !$this->isRevisionCurrent() ) {
987 - $timestamp = Revision::getTimestampFromId( $this->mTitle, $this->mRevisionId );
 969+ $timestamp = Revision::getTimestampFromId( $this->getTitle(), $this->mRevisionId );
988970 } else {
989971 $timestamp = $article->getTimestamp();
990972 }
991973
992974 if ( $timestamp ) {
993 - $d = $wgLang->date( $timestamp, true );
994 - $t = $wgLang->time( $timestamp, true );
 975+ $d = $this->getContext()->getLang()->date( $timestamp, true );
 976+ $t = $this->getContext()->getLang()->time( $timestamp, true );
995977 $s = ' ' . wfMsg( 'lastmodifiedat', $d, $t );
996978 } else {
997979 $s = '';
@@ -1116,9 +1098,8 @@
11171099 }
11181100
11191101 function showEmailUser( $id ) {
1120 - global $wgUser;
11211102 $targetUser = User::newFromId( $id );
1122 - return $wgUser->canSendEmail() && # the sending user must have a confirmed email address
 1103+ return $this->getContext()->getUser()->canSendEmail() && # the sending user must have a confirmed email address
11231104 $targetUser->canReceiveEmail(); # the target user must have a confirmed email address and allow emails from users
11241105 }
11251106
@@ -1238,10 +1219,9 @@
12391220 */
12401221 function buildSidebar() {
12411222 global $parserMemc, $wgEnableSidebarCache, $wgSidebarCacheExpiry;
1242 - global $wgLang;
12431223 wfProfileIn( __METHOD__ );
12441224
1245 - $key = wfMemcKey( 'sidebar', $wgLang->getCode() );
 1225+ $key = wfMemcKey( 'sidebar', $this->getContext()->getLang()->getCode() );
12461226
12471227 if ( $wgEnableSidebarCache ) {
12481228 $cachedsidebar = $parserMemc->get( $key );
@@ -1301,7 +1281,7 @@
13021282 $line = trim( $line, '* ' );
13031283
13041284 if ( strpos( $line, '|' ) !== false ) { // sanity check
1305 - $line = MessageCache::singleton()->transform( $line, false, null, $this->mTitle );
 1285+ $line = MessageCache::singleton()->transform( $line, false, null, $this->getTitle() );
13061286 $line = array_map( 'trim', explode( '|', $line, 2 ) );
13071287 $link = wfMsgForContent( $line[0] );
13081288
@@ -1346,7 +1326,7 @@
13471327 $options = new ParserOptions();
13481328 $options->setEditSection( false );
13491329 $options->setInterfaceMessage( true );
1350 - $wikiBar[$heading] = $wgParser->parse( wfMsgForContentNoTrans( $line ) , $this->mTitle, $options )->getText();
 1330+ $wikiBar[$heading] = $wgParser->parse( wfMsgForContentNoTrans( $line ) , $this->getTitle(), $options )->getText();
13511331 } else {
13521332 continue;
13531333 }
@@ -1375,18 +1355,11 @@
13761356 /**
13771357 * Gets new talk page messages for the current user.
13781358 * @return MediaWiki message or if no new talk page messages, nothing
1379 - * The format without an explicit $out argument is deprecated
13801359 */
1381 - function getNewtalks( OutputPage $out=null ) {
1382 - global $wgUser;
 1360+ function getNewtalks() {
 1361+ $out = $this->getContext()->getOutput();
13831362
1384 - if ( is_null( $out ) ) {
1385 - // Backwards compatibility for when there was no $out arg
1386 - global $wgOut;
1387 - $out = $wgOut;
1388 - }
1389 -
1390 - $newtalks = $wgUser->getNewMessageLinks();
 1363+ $newtalks = $this->getContext()->getUser()->getNewMessageLinks();
13911364 $ntl = '';
13921365
13931366 if ( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) {
@@ -1444,7 +1417,7 @@
14451418 * @return String: HTML fragment
14461419 */
14471420 private function getCachedNotice( $name ) {
1448 - global $wgOut, $wgRenderHashAppend, $parserMemc;
 1421+ global $wgRenderHashAppend, $parserMemc;
14491422
14501423 wfProfileIn( __METHOD__ );
14511424
@@ -1481,14 +1454,9 @@
14821455 }
14831456
14841457 if ( $needParse ) {
1485 - if( is_object( $wgOut ) ) {
1486 - $parsed = $wgOut->parse( $notice );
1487 - $parserMemc->set( $key, array( 'html' => $parsed, 'hash' => md5( $notice ) ), 600 );
1488 - $notice = $parsed;
1489 - } else {
1490 - wfDebug( 'Skin::getCachedNotice called for ' . $name . ' with no $wgOut available' . "\n" );
1491 - $notice = '';
1492 - }
 1458+ $parsed = $this->getContext()->getOutput()->parse( $notice );
 1459+ $parserMemc->set( $key, array( 'html' => $parsed, 'hash' => md5( $notice ) ), 600 );
 1460+ $notice = $parsed;
14931461 }
14941462
14951463 $notice = '<div id="localNotice">' .$notice . '</div>';
@@ -1504,7 +1472,7 @@
15051473 function getNamespaceNotice() {
15061474 wfProfileIn( __METHOD__ );
15071475
1508 - $key = 'namespacenotice-' . $this->mTitle->getNsText();
 1476+ $key = 'namespacenotice-' . $this->getTitle()->getNsText();
15091477 $namespaceNotice = $this->getCachedNotice( $key );
15101478 if ( $namespaceNotice && substr( $namespaceNotice, 0, 7 ) != '<p>&lt;' ) {
15111479 $namespaceNotice = '<div id="namespacebanner">' . $namespaceNotice . '</div>';
@@ -1522,13 +1490,11 @@
15231491 * @return String: HTML fragment
15241492 */
15251493 function getSiteNotice() {
1526 - global $wgUser;
1527 -
15281494 wfProfileIn( __METHOD__ );
15291495 $siteNotice = '';
15301496
15311497 if ( wfRunHooks( 'SiteNoticeBefore', array( &$siteNotice, $this ) ) ) {
1532 - if ( is_object( $wgUser ) && $wgUser->isLoggedIn() ) {
 1498+ if ( is_object( $this->getContext()->getUser() ) && $this->getContext()->getUser()->isLoggedIn() ) {
15331499 $siteNotice = $this->getCachedNotice( 'sitenotice' );
15341500 } else {
15351501 $anonNotice = $this->getCachedNotice( 'anonnotice' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r85252Followup r85250; Revert a static method back to use of $wgRequest... :/ damni...dantman12:55, 3 April 2011
r85273follow up to r85250; use getTitle method as should have been donejeroendedauw19:53, 3 April 2011
r85281follow up to r85250jeroendedauw20:55, 3 April 2011
r85297Fix use of mUser noted by c15657 on r85250.dantman23:38, 3 April 2011
r90934(follow-up to some RequestContext revision) When Special:userlogin creates a ...bawolff04:00, 28 June 2011
r91496DumpHTML fixes:...aaron21:32, 5 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85240Implement the RequestContext class. Some credit to IAlex, ;) other credit for...dantman10:41, 3 April 2011

Comments

#Comment by Krinkle (talk | contribs)   14:59, 3 April 2011

(3 lines skipped) [03-Apr-2011 14:54:59] PHP Fatal error: Call to a member function getUserPage() on a non-object in /www/w/includes/Skin.php on line 1366

From there:


			$userTitle = $this->mUser->getUserPage();

From here:


-		$this->mUser = $wgUser;
#Comment by Dantman (talk | contribs)   23:39, 3 April 2011

Fixed.

#Comment by Tbleher (talk | contribs)   06:09, 18 April 2011

Could you fix the DumpHTML extension that was broken by this change?

Call to undefined method SkinVector::setTitle
Backtrace:
#0 [internal function]: Skin->__call('setTitle', Array)
#1 /srv/www/mediawiki/extensions/DumpHTML/dumpHTML.inc(819): SkinVector->setTitle(Object(Title))
#2 /srv/www/mediawiki/extensions/DumpHTML/dumpHTML.inc(482): DumpHTML->getArticleHTML(Object(Title))
#3 /srv/www/mediawiki/extensions/DumpHTML/dumpHTML.inc(209): DumpHTML->doArticle(Object(Title))
#4 /srv/www/mediawiki/extensions/DumpHTML/dumpHTML.inc(148): DumpHTML->doArticles()
#5 /srv/www/mediawiki/extensions/DumpHTML/dumpHTML.php(152): DumpHTML->doEverything()
#6 {main}

I do not know enough about the new RequestContext stuff to properly fix this extension.

(Small general question: should a revision be marked "fixme" if it breaks an extension not currently used by the WMF?)

Status & tagging log