r42990 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42989‎ | r42990 | r42991 >
Date:10:08, 1 November 2008
Author:dantman
Status:old (Comments)
Tags:
Comment:
TitleRewrite: Making old revision viewing and page diffs respect the
title for the individual revision.
Modified paths:
  • /branches/titlerewrite/phase3/includes/Article.php (modified) (history)
  • /branches/titlerewrite/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: branches/titlerewrite/phase3/includes/Article.php
@@ -731,7 +731,7 @@
732732 # diff page instead of the article.
733733
734734 if ( !is_null( $diff ) ) {
735 - $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
 735+ $wgOut->setPageTitle( $this->mTitle->getPrefixedText( $oldid ) );
736736
737737 $diff = $wgRequest->getVal( 'diff' );
738738 $htmldiff = $wgRequest->getVal( 'htmldiff' , false);
@@ -868,7 +868,7 @@
869869 if( $this->mRevision->isDeleted( Revision::DELETED_TEXT ) ) {
870870 if( !$this->mRevision->userCan( Revision::DELETED_TEXT ) ) {
871871 $wgOut->addWikiMsg( 'rev-deleted-text-permission' );
872 - $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
 872+ $wgOut->setPageTitle( $this->mTitle->getPrefixedText( $oldid ) );
873873 wfProfileOut( __METHOD__ );
874874 return;
875875 } else {
@@ -927,7 +927,7 @@
928928 /* title may have been set from the cache */
929929 $t = $wgOut->getPageTitle();
930930 if( empty( $t ) ) {
931 - $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
 931+ $wgOut->setPageTitle( $this->mTitle->getPrefixedText( $oldid ) );
932932
933933 # For the main page, overwrite the <title> element with the con-
934934 # tents of 'pagetitle-view-mainpage' instead of the default (if
@@ -2579,8 +2579,7 @@
25802580 return array(array('notanarticle'));
25812581 }
25822582
2583 - $from = str_replace( '_', ' ', $fromP );
2584 - if( $from != $current->getUserText() ) {
 2583+ if( $fromP != $current->getUser() ) {
25852584 $resultDetails = array( 'current' => $current );
25862585 return array(array('alreadyrolled',
25872586 htmlspecialchars($this->mTitle->getPrefixedText()),
@@ -2591,7 +2590,7 @@
25922591
25932592 # Get the last edit not by this guy
25942593 $user = intval( $current->getUser() );
2595 - $user_text = $dbw->addQuotes( $current->getUserText() );
 2594+ $user_text = $dbw->addQuotes( $current->getUser() );
25962595 $s = $dbw->selectRow( 'revision',
25972596 array( 'rev_id', 'rev_timestamp', 'rev_deleted' ),
25982597 array( 'rev_page' => $current->getPage(),
Index: branches/titlerewrite/phase3/includes/Title.php
@@ -496,9 +496,27 @@
497497
498498 /** Simple accessors */
499499 /**
 500+<<<<<<< .mine
500501 * Get the interface text form of the main part
 502+ * @param \type{\int} the revision id of the ui title to use
 503+=======
 504+ * Get the interface text form of the main part
 505+>>>>>>> .r42989
501506 * @return \type{\string} Main part of the title
502507 */
 508+<<<<<<< .mine
 509+ public function getText( $oldid = 0 ) {
 510+ if( !isset($this->mTextform) || $oldid != 0 ) {
 511+ $rev = Revision::newFromTitle($this, $oldid);
 512+ $ui = $rev ? $rev->getTitleUI() : null;
 513+ $title = isset($ui) ? $ui
 514+ : str_replace( '_', ' ', $this->mDbkeyform );
 515+ if( $oldid == 0 ) $this->mTextform = $title;
 516+ return $title;
 517+ }
 518+ return $this->mTextform;
 519+ }
 520+=======
503521 public function getText() {
504522 if( !isset($this->mTextform) ) {
505523 $rev = Revision::newFromTitle($this);
@@ -508,6 +526,7 @@
509527 }
510528 return $this->mTextform;
511529 }
 530+>>>>>>> .r42989
512531 /**
513532 * Get the URL-encoded form of the main part
514533 * @return \type{\string} Main part of the title, URL-encoded
@@ -621,12 +640,21 @@
622641 /**
623642 * Get the prefixed title with spaces.
624643 * This is the form usually used for display
 644+ * @param \type{\int} the revision id of the ui title to use
625645 * @return \type{\string} the prefixed title, with spaces
626646 */
 647+<<<<<<< .mine
 648+ public function getPrefixedText( $oldid = 0 ) {
 649+ if ( !isset( $this->mPrefixedText ) || $oldid != 0 ) {
 650+ $s = $this->prefix( $this->getText( $oldid ) );
 651+ if( $oldid == 0 ) $this->mPrefixedText = $s;
 652+ return $s;
 653+=======
627654 public function getPrefixedText() {
628655 if ( empty( $this->mPrefixedText ) ) { // FIXME: bad usage of empty() ?
629656 $s = $this->prefix( $this->getText() );
630657 $this->mPrefixedText = $s;
 658+>>>>>>> .r42989
631659 }
632660 return $this->mPrefixedText;
633661 }
@@ -634,11 +662,12 @@
635663 /**
636664 * Get the prefixed title with spaces, plus any fragment
637665 * (part beginning with '#')
 666+ * @param \type{\int} the revision id of the ui title to use
638667 * @return \type{\string} the prefixed title, with spaces and
639668 * the fragment, including '#'
640669 */
641 - public function getFullText() {
642 - $text = $this->getPrefixedText();
 670+ public function getFullText( $oldid = 0 ) {
 671+ $text = $this->getPrefixedText( $oldid = 0 );
643672 if( '' != $this->mFragment ) {
644673 $text .= '#' . $this->mFragment;
645674 }

Comments

#Comment by Bryan (talk | contribs)   12:16, 1 November 2008

Conflict resolving?

Status & tagging log