X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=blobdiff_plain;f=includes%2FWikiPage.php;h=3910bf87f90bff500879dc34ec73df37da5a9e5e;hb=a830943203e156c4aa242e0f931c1dac0f00925c;hp=afe5c0009b5e8fa9ffebfdd5f09574c8fccf85a1;hpb=38828a93a17e63abb85442c90f04f6cac20034ec;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/WikiPage.php b/includes/WikiPage.php index afe5c0009b..3910bf87f9 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -257,11 +257,20 @@ class WikiPage extends Page { /** * Clear the object + * @return void */ public function clear() { $this->mDataLoaded = false; $this->mDataLoadedFrom = self::DATA_NOT_LOADED; + $this->clearCacheFields(); + } + + /** + * Clear the object cache fields + * @return void + */ + protected function clearCacheFields() { $this->mCounter = null; $this->mRedirectTarget = null; # Title object if set $this->mLastRevision = null; # Latest revision @@ -418,10 +427,18 @@ class WikiPage extends Page { $this->mTouched = wfTimestamp( TS_MW, $data->page_touched ); $this->mIsRedirect = intval( $data->page_is_redirect ); $this->mLatest = intval( $data->page_latest ); + // Bug 37225: $latest may no longer match the cached latest Revision object. + // Double-check the ID of any cached latest Revision object for consistency. + if ( $this->mLastRevision && $this->mLastRevision->getId() != $this->mLatest ) { + $this->mLastRevision = null; + $this->mTimestamp = ''; + } } else { $lc->addBadLinkObj( $this->mTitle ); $this->mTitle->loadFromRow( false ); + + $this->clearCacheFields(); } $this->mDataLoaded = true;