mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 14:56:20 +00:00
Merge "Respect oldid parameter in NWE"
This commit is contained in:
commit
f0a70ce6a2
|
@ -232,9 +232,9 @@ class ApiVisualEditor extends ApiBase {
|
||||||
} elseif ( $params['paction'] === 'wikitext' ) {
|
} elseif ( $params['paction'] === 'wikitext' ) {
|
||||||
$apiParams = [
|
$apiParams = [
|
||||||
'action' => 'query',
|
'action' => 'query',
|
||||||
'titles' => $title->getPrefixedDBkey(),
|
'revids' => $oldid,
|
||||||
'prop' => 'revisions',
|
'prop' => 'revisions',
|
||||||
'rvprop' => 'content'
|
'rvprop' => 'content|ids'
|
||||||
];
|
];
|
||||||
|
|
||||||
if ( isset( $params['section'] ) ) {
|
if ( isset( $params['section'] ) ) {
|
||||||
|
@ -252,9 +252,14 @@ class ApiVisualEditor extends ApiBase {
|
||||||
$api->execute();
|
$api->execute();
|
||||||
$result = $api->getResult()->getResultData();
|
$result = $api->getResult()->getResultData();
|
||||||
$pid = $title->getArticleID();
|
$pid = $title->getArticleID();
|
||||||
$content = isset( $result['query']['pages'][$pid]['revisions']['0']['content'] ) ?
|
$content = false;
|
||||||
$result['query']['pages'][$pid]['revisions']['0']['content'] :
|
if ( isset( $result['query']['pages'][$pid]['revisions'] ) ) {
|
||||||
false;
|
foreach ( $result['query']['pages'][$pid]['revisions'] as $revArr ) {
|
||||||
|
if ( $revArr['revid'] === $oldid ) {
|
||||||
|
$content = $revArr['content'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if ( $content === false ) {
|
if ( $content === false ) {
|
||||||
$this->dieUsage( 'Error contacting the document server', 'docserver' );
|
$this->dieUsage( 'Error contacting the document server', 'docserver' );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue