From: Timo Tijhof Date: Thu, 17 Aug 2017 22:22:36 +0000 (-0700) Subject: Skin: Remove redundant use of QuickTemplate::setRef() X-Git-Tag: 1.31.0-rc.0~2365^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=2c01147c13be40af16407b69d29b03ecfd70a534;p=lhc%2Fweb%2Fwiklou.git Skin: Remove redundant use of QuickTemplate::setRef() As part of long-term moving towards having skins consume prepared data and not making additional run-time database queries or additional PHP-specific semantics and global state, try to phase out use of QuickTemplate::setRef(), which is incompatible with the idea of data only flowing in one direction (given it allows the value to change at any time). * jsmimetype: Deprecated/unused, has a constant value for compat. * mimetype: Obsolete, Content-Type header comes from OutputPage. * skin: Objects are references by default, '$this' can't be modified anyway. Bug: T140664 Change-Id: Ia505cc3e1b774a380fb36b4f0e2522550aef5bbd --- diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php index 5ad1b116f7..cbffe1e571 100644 --- a/includes/skins/SkinTemplate.php +++ b/includes/skins/SkinTemplate.php @@ -306,8 +306,8 @@ class SkinTemplate extends Skin { $tpl->set( 'pagetitle', $out->getHTMLTitle() ); $tpl->set( 'displaytitle', $out->mPageLinkTitle ); - $tpl->setRef( 'thispage', $this->thispage ); - $tpl->setRef( 'titleprefixeddbkey', $this->thispage ); + $tpl->set( 'thispage', $this->thispage ); + $tpl->set( 'titleprefixeddbkey', $this->thispage ); $tpl->set( 'titletext', $title->getText() ); $tpl->set( 'articleid', $title->getArticleID() ); @@ -336,32 +336,32 @@ class SkinTemplate extends Skin { 'href' => $link ]; } - $tpl->setRef( 'feeds', $feeds ); + $tpl->set( 'feeds', $feeds ); } else { $tpl->set( 'feeds', false ); } - $tpl->setRef( 'mimetype', $wgMimeType ); - $tpl->setRef( 'jsmimetype', $wgJsMimeType ); + $tpl->set( 'mimetype', $wgMimeType ); + $tpl->set( 'jsmimetype', $wgJsMimeType ); $tpl->set( 'charset', 'UTF-8' ); - $tpl->setRef( 'wgScript', $wgScript ); - $tpl->setRef( 'skinname', $this->skinname ); + $tpl->set( 'wgScript', $wgScript ); + $tpl->set( 'skinname', $this->skinname ); $tpl->set( 'skinclass', static::class ); - $tpl->setRef( 'skin', $this ); - $tpl->setRef( 'stylename', $this->stylename ); + $tpl->set( 'skin', $this ); + $tpl->set( 'stylename', $this->stylename ); $tpl->set( 'printable', $out->isPrintable() ); $tpl->set( 'handheld', $request->getBool( 'handheld' ) ); - $tpl->setRef( 'loggedin', $this->loggedin ); + $tpl->set( 'loggedin', $this->loggedin ); $tpl->set( 'notspecialpage', !$title->isSpecialPage() ); $tpl->set( 'searchaction', $this->escapeSearchLink() ); $tpl->set( 'searchtitle', SpecialPage::getTitleFor( 'Search' )->getPrefixedDBkey() ); $tpl->set( 'search', trim( $request->getVal( 'search' ) ) ); - $tpl->setRef( 'stylepath', $wgStylePath ); - $tpl->setRef( 'articlepath', $wgArticlePath ); - $tpl->setRef( 'scriptpath', $wgScriptPath ); - $tpl->setRef( 'serverurl', $wgServer ); - $tpl->setRef( 'logopath', $wgLogo ); - $tpl->setRef( 'sitename', $wgSitename ); + $tpl->set( 'stylepath', $wgStylePath ); + $tpl->set( 'articlepath', $wgArticlePath ); + $tpl->set( 'scriptpath', $wgScriptPath ); + $tpl->set( 'serverurl', $wgServer ); + $tpl->set( 'logopath', $wgLogo ); + $tpl->set( 'sitename', $wgSitename ); $userLang = $this->getLanguage(); $userLangCode = $userLang->getHtmlCode(); @@ -374,8 +374,8 @@ class SkinTemplate extends Skin { $tpl->set( 'capitalizeallnouns', $userLang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '' ); $tpl->set( 'showjumplinks', true ); // showjumplinks preference has been removed $tpl->set( 'username', $this->loggedin ? $this->username : null ); - $tpl->setRef( 'userpage', $this->userpage ); - $tpl->setRef( 'userpageurl', $this->userpageUrlDetails['href'] ); + $tpl->set( 'userpage', $this->userpage ); + $tpl->set( 'userpageurl', $this->userpageUrlDetails['href'] ); $tpl->set( 'userlang', $userLangCode ); // Users can have their language set differently than the