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
Merge "Move PageArchive class to it's own file"
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiQueryRevisionsBase.php
diff --git
a/includes/api/ApiQueryRevisionsBase.php
b/includes/api/ApiQueryRevisionsBase.php
index
266d699
..
696ec87
100644
(file)
--- a/
includes/api/ApiQueryRevisionsBase.php
+++ b/
includes/api/ApiQueryRevisionsBase.php
@@
-70,10
+70,7
@@
abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
&& $params['diffto'] != 'prev' && $params['diffto'] != 'next'
) {
$p = $this->getModulePrefix();
&& $params['diffto'] != 'prev' && $params['diffto'] != 'next'
) {
$p = $this->getModulePrefix();
- $this->dieUsage(
- "{$p}diffto must be set to a non-negative number, \"prev\", \"next\" or \"cur\"",
- 'diffto'
- );
+ $this->dieWithError( [ 'apierror-baddiffto', $p ], 'diffto' );
}
// Check whether the revision exists and is readable,
// DifferenceEngine returns a rather ambiguous empty
}
// Check whether the revision exists and is readable,
// DifferenceEngine returns a rather ambiguous empty
@@
-81,10
+78,10
@@
abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
if ( $params['diffto'] != 0 ) {
$difftoRev = Revision::newFromId( $params['diffto'] );
if ( !$difftoRev ) {
if ( $params['diffto'] != 0 ) {
$difftoRev = Revision::newFromId( $params['diffto'] );
if ( !$difftoRev ) {
- $this->die
UsageMsg( [ '
nosuchrevid', $params['diffto'] ] );
+ $this->die
WithError( [ 'apierror-
nosuchrevid', $params['diffto'] ] );
}
if ( !$difftoRev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
}
if ( !$difftoRev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
- $this->
setWarning( "Couldn't diff to r{$difftoRev->getId()}: content is hidden"
);
+ $this->
addWarning( [ 'apiwarn-difftohidden', $difftoRev->getId() ]
);
$params['diffto'] = null;
}
}
$params['diffto'] = null;
}
}
@@
-262,8
+259,12
@@
abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
if ( $content && $this->section !== false ) {
$content = $content->getSection( $this->section, false );
if ( !$content ) {
if ( $content && $this->section !== false ) {
$content = $content->getSection( $this->section, false );
if ( !$content ) {
- $this->dieUsage(
- "There is no section {$this->section} in r" . $revision->getId(),
+ $this->dieWithError(
+ [
+ 'apierror-nosuchsection-what',
+ wfEscapeWikiText( $this->section ),
+ $this->msg( 'revid', $revision->getId() )
+ ],
'nosuchsection'
);
}
'nosuchsection'
);
}
@@
-294,9
+295,14
@@
abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
$vals['parsetree'] = $xml;
} else {
$vals['badcontentformatforparsetree'] = true;
$vals['parsetree'] = $xml;
} else {
$vals['badcontentformatforparsetree'] = true;
- $this->setWarning( 'Conversion to XML is supported for wikitext only, ' .
- $title->getPrefixedDBkey() .
- ' uses content model ' . $content->getModel() );
+ $this->addWarning(
+ [
+ 'apierror-parsetree-notwikitext-title',
+ wfEscapeWikiText( $title->getPrefixedText() ),
+ $content->getModel()
+ ],
+ 'parsetree-notwikitext'
+ );
}
}
}
}
}
}
@@
-315,9
+321,11
@@
abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
ParserOptions::newFromContext( $this->getContext() )
);
} else {
ParserOptions::newFromContext( $this->getContext() )
);
} else {
- $this->setWarning( 'Template expansion is supported for wikitext only, ' .
- $title->getPrefixedDBkey() .
- ' uses content model ' . $content->getModel() );
+ $this->addWarning( [
+ 'apierror-templateexpansion-notwikitext',
+ wfEscapeWikiText( $title->getPrefixedText() ),
+ $content->getModel()
+ ] );
$vals['badcontentformat'] = true;
$text = false;
}
$vals['badcontentformat'] = true;
$text = false;
}
@@
-336,9
+344,8
@@
abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
$model = $content->getModel();
if ( !$content->isSupportedFormat( $format ) ) {
$model = $content->getModel();
if ( !$content->isSupportedFormat( $format ) ) {
- $name = $title->getPrefixedDBkey();
- $this->setWarning( "The requested format {$this->contentFormat} is not " .
- "supported for content model $model used by $name" );
+ $name = wfEscapeWikiText( $title->getPrefixedText() );
+ $this->addWarning( [ 'apierror-badformat', $this->contentFormat, $model, $name ] );
$vals['badcontentformat'] = true;
$text = false;
} else {
$vals['badcontentformat'] = true;
$text = false;
} else {
@@
-370,9
+377,8
@@
abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
if ( $this->contentFormat
&& !ContentHandler::getForModelID( $model )->isSupportedFormat( $this->contentFormat )
) {
if ( $this->contentFormat
&& !ContentHandler::getForModelID( $model )->isSupportedFormat( $this->contentFormat )
) {
- $name = $title->getPrefixedDBkey();
- $this->setWarning( "The requested format {$this->contentFormat} is not " .
- "supported for content model $model used by $name" );
+ $name = wfEscapeWikiText( $title->getPrefixedText() );
+ $this->addWarning( [ 'apierror-badformat', $this->contentFormat, $model, $name ] );
$vals['diff']['badcontentformat'] = true;
$engine = null;
} else {
$vals['diff']['badcontentformat'] = true;
$engine = null;
} else {