Index: trunk/phase3/includes/Article.php |
— | — | @@ -551,10 +551,9 @@ |
552 | 552 | // We should instead work with the Revision object when we need it... |
553 | 553 | $this->mContent = $revision->getText( Revision::FOR_THIS_USER ); // Loads if user is allowed |
554 | 554 | |
555 | | - $this->mUser = $revision->getUser(); |
556 | | - $this->mUserText = $revision->getUserText(); |
557 | | - $this->mComment = $revision->getComment(); |
558 | | - $this->mTimestamp = wfTimestamp( TS_MW, $revision->getTimestamp() ); |
| 555 | + if ( $revision->getId() == $this->mLatest ) { |
| 556 | + $this->setLastEdit( $revision ); |
| 557 | + } |
559 | 558 | |
560 | 559 | $this->mRevIdFetched = $revision->getId(); |
561 | 560 | $this->mContentLoaded = true; |
— | — | @@ -705,18 +704,26 @@ |
706 | 705 | return; |
707 | 706 | } |
708 | 707 | |
709 | | - $this->mLastRevision = Revision::loadFromPageId( wfGetDB( DB_MASTER ), $id ); |
710 | | - if ( !is_null( $this->mLastRevision ) ) { |
711 | | - $this->mUser = $this->mLastRevision->getUser(); |
712 | | - $this->mUserText = $this->mLastRevision->getUserText(); |
713 | | - $this->mTimestamp = $this->mLastRevision->getTimestamp(); |
714 | | - $this->mComment = $this->mLastRevision->getComment(); |
715 | | - $this->mMinorEdit = $this->mLastRevision->isMinor(); |
716 | | - $this->mRevIdFetched = $this->mLastRevision->getId(); |
| 708 | + $revision = Revision::loadFromPageId( wfGetDB( DB_MASTER ), $id ); |
| 709 | + if ( !is_null( $revision ) ) { |
| 710 | + $this->setLastEdit( $revision ); |
717 | 711 | } |
718 | 712 | } |
719 | 713 | |
720 | 714 | /** |
| 715 | + * Set the lastest revision |
| 716 | + */ |
| 717 | + protected function setLastEdit( Revision $revision ) { |
| 718 | + $this->mLastRevision = $revision; |
| 719 | + $this->mUser = $revision->getUser(); |
| 720 | + $this->mUserText = $revision->getUserText(); |
| 721 | + $this->mTimestamp = $revision->getTimestamp(); |
| 722 | + $this->mComment = $revision->getComment(); |
| 723 | + $this->mMinorEdit = $revision->isMinor(); |
| 724 | + $this->mRevIdFetched = $revision->getId(); |
| 725 | + } |
| 726 | + |
| 727 | + /** |
721 | 728 | * @return string GMT timestamp of last article revision |
722 | 729 | **/ |
723 | 730 | |