https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113468
Revision: 113468
Author: ialex
Date: 2012-03-09 14:50:39 +0000 (Fri, 09 Mar 2012)
Log Message:
-----------
Use WikiPage::getRevision() instead of another Revision object if the oldid
parameter corresponds to the page's latest revision
Modified Paths:
--------------
trunk/phase3/includes/Article.php
Modified: trunk/phase3/includes/Article.php
===================================================================
--- trunk/phase3/includes/Article.php 2012-03-09 14:48:20 UTC (rev 113467)
+++ trunk/phase3/includes/Article.php 2012-03-09 14:50:39 UTC (rev 113468)
@@ -248,12 +248,16 @@
if ( $oldid !== 0 ) {
# Load the given revision and check whether the page is
another one.
# In that case, update this instance to reflect the
change.
- $this->mRevision = Revision::newFromId( $oldid );
- if ( $this->mRevision !== null ) {
- // Revision title doesn't match the page title
given?
- if ( $this->mPage->getID() !=
$this->mRevision->getPage() ) {
- $function = array( get_class(
$this->mPage ), 'newFromID' );
- $this->mPage = call_user_func(
$function, $this->mRevision->getPage() );
+ if ( $oldid === $this->mPage->getLatest() ) {
+ $this->mRevision = $this->mPage->getRevision();
+ } else {
+ $this->mRevision = Revision::newFromId( $oldid
);
+ if ( $this->mRevision !== null ) {
+ // Revision title doesn't match the
page title given?
+ if ( $this->mPage->getID() !=
$this->mRevision->getPage() ) {
+ $function = array( get_class(
$this->mPage ), 'newFromID' );
+ $this->mPage = call_user_func(
$function, $this->mRevision->getPage() );
+ }
}
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs