r64851 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64850‎ | r64851 | r64852 >
Date:05:46, 10 April 2010
Author:philip
Status:reverted (Comments)
Tags:
Comment:
Fix bug 23115 again. Follow up r64821, r64823 and r64827. Rewrite the converted title to HTML title if the HTML title haven't set by other messages.
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/languages/LanguageConverter.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -303,7 +303,7 @@
304304 * to internalParse() which does all the real work.
305305 */
306306
307 - global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion, $wgDisableTitleConversion, $wgUser, $wgRequest;
 307+ global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion, $wgDisableTitleConversion, $wgUser, $wgRequest, $wgOut;
308308 $fname = __METHOD__.'-' . wfGetCaller();
309309 wfProfileIn( __METHOD__ );
310310 wfProfileIn( $fname );
@@ -386,7 +386,7 @@
387387 if ( $convruletitle ) {
388388 $this->mOutput->setTitleText( $convruletitle );
389389 } else {
390 - $this->mOutput->setTitleText( $wgContLang->convert( $this->mOutput->getTitleText() ) );
 390+ $wgOut->setPageTitle( $wgContLang->convert( $wgOut->getPageTitle(), true ) );
391391 }
392392 }
393393
Index: trunk/phase3/includes/OutputPage.php
@@ -9,7 +9,7 @@
1010 var $mMetatags = array(), $mKeywords = array(), $mLinktags = array();
1111 var $mExtStyles = array();
1212 var $mPagetitle = '', $mBodytext = '', $mDebugtext = '';
13 - var $mHTMLtitle = '', $mIsarticle = true, $mPrintable = false;
 13+ var $mHTMLtitle = '', $mHTMLtitleFromPagetitle = true, $mIsarticle = true, $mPrintable = false;
1414 var $mSubtitle = '', $mRedirect = '', $mStatusCode;
1515 var $mLastModified = '', $mETag = false;
1616 var $mCategoryLinks = array(), $mCategories = array(), $mLanguageLinks = array();
@@ -445,10 +445,19 @@
446446 }
447447
448448 /**
449 - * "HTML title" means the contents of <title>. It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file.
 449+ * "HTML title" means the contents of <title>.
 450+ * It is stored as plain, unescaped text and will be run through htmlspecialchars in the skin file.
 451+ * If $name is from page title, it can only override names which are also from page title,
 452+ * but if it is not from page title, it can override all other names.
450453 */
451 - public function setHTMLTitle( $name ) {
452 - $this->mHTMLtitle = $name;
 454+ public function setHTMLTitle( $name, $frompagetitle = false ) {
 455+ if ( $frompagetitle && $this->mHTMLtitleFromPagetitle ) {
 456+ $this->mHTMLtitle = $name;
 457+ }
 458+ elseif ( $this->mHTMLtitleFromPagetitle ) {
 459+ $this->mHTMLtitle = $name;
 460+ $this->mHTMLtitleFromPagetitle = false;
 461+ }
453462 }
454463
455464 /**
@@ -478,7 +487,7 @@
479488 }
480489
481490 # change "<i>foo&amp;bar</i>" to "foo&bar"
482 - $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ) );
 491+ $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ), true );
483492 }
484493
485494 /**
Index: trunk/phase3/languages/LanguageConverter.php
@@ -547,12 +547,16 @@
548548 * @param $text String: text to be converted
549549 * @return String: converted text
550550 */
551 - public function convert( $text ) {
 551+ public function convert( $text, $istitle = false ) {
552552 global $wgDisableLangConversion;
553553 if ( $wgDisableLangConversion ) return $text;
554554
555555 $variant = $this->getPreferredVariant();
556556
 557+ if( $istitle ) {
 558+ $text = $this->convertNamespace( $text, $variant );
 559+ }
 560+
557561 return $this->recursiveConvertTopLevel( $text, $variant );
558562 }
559563

Follow-up revisions

RevisionCommit summaryAuthorDate
r64855Follow up r64851. Apply on REL1_16.philip06:27, 10 April 2010
r64856Follow up r64851. Remove $wgOut.philip07:07, 10 April 2010
r64857Follow up r64851. Remove $wgOut. Apply on REL1_16.philip07:28, 10 April 2010
r64876Proposed cleanup of recent LanguageConverter-related commits:...tstarling13:38, 10 April 2010
r649291.16wmf4: Merge langconverter fixes from trunk: r64851, r64856, r64876, r6489...catrope12:01, 11 April 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r64814Follow-up r64811 on fixing bug 23115....platonides17:56, 9 April 2010
r64821Bug 23115: Follow up on r64819. Apply on 1.16wmf4.philip19:17, 9 April 2010
r64823Recover namespace names.platonides19:46, 9 April 2010
r64827Convert the previous title instead of getting it again, so the Main Page keep...platonides20:27, 9 April 2010

Comments

#Comment by Tim Starling (talk | contribs)   06:41, 10 April 2010

How could that possibly work on a parser cache hit?

Status & tagging log