From: Adam Roses Wight Date: Sun, 5 Apr 2015 06:53:50 +0000 (-0700) Subject: Accessor to get EditPage parent revision ID X-Git-Tag: 1.31.0-rc.0~8879^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=dd230364d6456a1893b6abcd93049a46269a7239;p=lhc%2Fweb%2Fwiklou.git Accessor to get EditPage parent revision ID Take from either the request parameter, calculated value, or the actual revision ID of the fetched page content. This will be used in more places, once we replace time-based conflict detection with revision-based detection. Bug: T58849 Change-Id: I29dcb4694cd9fee4622663b4d9787e975cb415ec --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 8d27eac833..6a17d21e66 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1136,6 +1136,26 @@ class EditPage { return $content; } + /** + * Get the edit's parent revision ID + * + * The "parent" revision is the ancestor that should be recorded in this + * page's revision history. It is either the revision ID of the in-memory + * article content, or in the case of a 3-way merge in order to rebase + * across a recoverable edit conflict, the ID of the newer revision to + * which we have rebased this page. + * + * @since 1.25 + * @return int Revision ID + */ + public function getParentRevId() { + if ( $this->parentRevId ) { + return $this->parentRevId; + } else { + return $this->mArticle->getRevIdFetched(); + } + } + /** * Get the current content of the page. This is basically similar to * WikiPage::getContent( Revision::RAW ) except that when the page doesn't exist an empty @@ -2014,6 +2034,8 @@ class EditPage { if ( $result ) { $editContent = $result; + // Update parentRevId to what we just merged. + $this->parentRevId = $currentRevision->getId(); return true; } @@ -2472,8 +2494,7 @@ class EditPage { $wgOut->addHTML( Html::hidden( 'wpAutoSummary', $autosumm ) ); $wgOut->addHTML( Html::hidden( 'oldid', $this->oldid ) ); - $wgOut->addHTML( Html::hidden( 'parentRevId', - $this->parentRevId ?: $this->mArticle->getRevIdFetched() ) ); + $wgOut->addHTML( Html::hidden( 'parentRevId', $this->getParentRevId() ) ); $wgOut->addHTML( Html::hidden( 'format', $this->contentFormat ) ); $wgOut->addHTML( Html::hidden( 'model', $this->contentModel ) );