dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Include log id in api error response
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiEditPage.php
diff --git
a/includes/api/ApiEditPage.php
b/includes/api/ApiEditPage.php
index
f2bb273
..
f663cc6
100644
(file)
--- a/
includes/api/ApiEditPage.php
+++ b/
includes/api/ApiEditPage.php
@@
-195,9
+195,9
@@
class ApiEditPage extends ApiBase {
list( $params['undo'], $params['undoafter'] ) =
array( $params['undoafter'], $params['undo'] );
}
list( $params['undo'], $params['undoafter'] ) =
array( $params['undoafter'], $params['undo'] );
}
- $undoafterRev = Revision::newFromI
D
( $params['undoafter'] );
+ $undoafterRev = Revision::newFromI
d
( $params['undoafter'] );
}
}
- $undoRev = Revision::newFromI
D
( $params['undo'] );
+ $undoRev = Revision::newFromI
d
( $params['undo'] );
if ( is_null( $undoRev ) || $undoRev->isDeleted( Revision::DELETED_TEXT ) ) {
$this->dieUsageMsg( array( 'nosuchrevid', $params['undo'] ) );
}
if ( is_null( $undoRev ) || $undoRev->isDeleted( Revision::DELETED_TEXT ) ) {
$this->dieUsageMsg( array( 'nosuchrevid', $params['undo'] ) );
}
@@
-253,7
+253,8
@@
class ApiEditPage extends ApiBase {
'model' => $contentHandler->getModelID(),
'wpEditToken' => $params['token'],
'wpIgnoreBlankSummary' => '',
'model' => $contentHandler->getModelID(),
'wpEditToken' => $params['token'],
'wpIgnoreBlankSummary' => '',
- 'wpIgnoreBlankArticle' => true
+ 'wpIgnoreBlankArticle' => true,
+ 'wpIgnoreSelfRedirect' => true,
);
if ( !is_null( $params['summary'] ) ) {
);
if ( !is_null( $params['summary'] ) ) {
@@
-381,7
+382,7
@@
class ApiEditPage extends ApiBase {
// Run hooks
// Handle APIEditBeforeSave parameters
$r = array();
// Run hooks
// Handle APIEditBeforeSave parameters
$r = array();
- if ( !
wfRunHooks
( 'APIEditBeforeSave', array( $ep, $content, &$r ) ) ) {
+ if ( !
Hooks::run
( 'APIEditBeforeSave', array( $ep, $content, &$r ) ) ) {
if ( count( $r ) ) {
$r['result'] = 'Failure';
$apiResult->addValue( null, $this->getModuleName(), $r );
if ( count( $r ) ) {
$r['result'] = 'Failure';
$apiResult->addValue( null, $this->getModuleName(), $r );
@@
-406,7
+407,14
@@
class ApiEditPage extends ApiBase {
switch ( $status->value ) {
case EditPage::AS_HOOK_ERROR:
case EditPage::AS_HOOK_ERROR_EXPECTED:
switch ( $status->value ) {
case EditPage::AS_HOOK_ERROR:
case EditPage::AS_HOOK_ERROR_EXPECTED:
- $this->dieUsageMsg( 'hookaborted' );
+ if ( isset( $status->apiHookResult ) ) {
+ $r = $status->apiHookResult;
+ $r['result'] = 'Failure';
+ $apiResult->addValue( null, $this->getModuleName(), $r );
+ return;
+ } else {
+ $this->dieUsageMsg( 'hookaborted' );
+ }
case EditPage::AS_PARSE_ERROR:
$this->dieUsage( $status->getMessage(), 'parseerror' );
case EditPage::AS_PARSE_ERROR:
$this->dieUsage( $status->getMessage(), 'parseerror' );
@@
-445,6
+453,9
@@
class ApiEditPage extends ApiBase {
case EditPage::AS_NO_CREATE_PERMISSION:
$this->dieUsageMsg( 'nocreate-loggedin' );
case EditPage::AS_NO_CREATE_PERMISSION:
$this->dieUsageMsg( 'nocreate-loggedin' );
+ case EditPage::AS_NO_CHANGE_CONTENT_MODEL:
+ $this->dieUsageMsg( 'cantchangecontentmodel' );
+
case EditPage::AS_BLANK_ARTICLE:
$this->dieUsageMsg( 'blankpage' );
case EditPage::AS_BLANK_ARTICLE:
$this->dieUsageMsg( 'blankpage' );
@@
-565,7
+576,7
@@
class ApiEditPage extends ApiBase {
return 'csrf';
}
return 'csrf';
}
- p
ublic
function getExamplesMessages() {
+ p
rotected
function getExamplesMessages() {
return array(
'action=edit&title=Test&summary=test%20summary&' .
'text=article%20content&basetimestamp=2007-08-24T12:34:54Z&token=123ABC'
return array(
'action=edit&title=Test&summary=test%20summary&' .
'text=article%20content&basetimestamp=2007-08-24T12:34:54Z&token=123ABC'