*
* Created on Sep 7, 2006
*
- * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
$this->token = $params['token'];
if ( !empty( $params['contentformat'] ) ) {
- $n = ContentHandler::getContentFormatID( $params['contentformat'] );
-
- if ( is_int( $n ) ) {
- $this->contentFormat = $n;
- } else {
- $this->dieUsage( "Unknown format " . $params['contentformat'], 'badformat' );
- }
+ $this->contentFormat = $params['contentformat'];
}
// Possible indexes used
} else {
$this->setWarning( "Conversion to XML is supported for wikitext only, " .
$title->getPrefixedDBkey() .
- " uses content model #" . $content->getModel() .
- " (" . ContentHandler::getContentModelName( $content->getModel() ). ")" );
+ " uses content model " . $content->getModel() . ")" );
}
}
} else {
$this->setWarning( "Template expansion is supported for wikitext only, " .
$title->getPrefixedDBkey() .
- " uses content model #" . $content->getModel() .
- " (" . ContentHandler::getContentModelName( $content->getModel() ). ")" );
+ " uses content model " . $content->getModel() . ")" );
$text = false;
}
if ( !$content->isSupportedFormat( $format ) ) {
$model = $content->getModel();
- $formatName = ContentHandler::getContentFormatMimeType( $format );
- $modelName = ContentHandler::getContentModelName( $model );
$name = $title->getPrefixedDBkey();
- $this->dieUsage( "The requested format #{$this->contentFormat} ($formatName) is not supported for content model #$model ($modelName) used by $name", 'badformat' );
+ $this->dieUsage( "The requested format {$this->contentFormat} is not supported for content model $model used by $name", 'badformat' );
}
$text = $content->serialize( $format );
- $vals['textformat'] = ContentHandler::getContentFormatMimeType( $format );
+ $vals['contentformat'] = $format;
}
if ( $text !== false ) {
$model = $title->getContentModel();
if ( $this->contentFormat && !ContentHandler::getForModelID( $model )->isSupportedFormat( $this->contentFormat ) ) {
- $formatName = ContentHandler::getContentFormatMimeType( $this->contentFormat );
- $modelName = ContentHandler::getContentModelName( $model );
$name = $title->getPrefixedDBkey();
- $this->dieUsage( "The requested format #{$this->contentFormat} ($formatName) is not supported for content model #$model ($modelName) used by $name", 'badformat' );
+ $this->dieUsage( "The requested format {$this->contentFormat} is not supported for content model $model used by $name", 'badformat' );
}
$difftocontent = ContentHandler::makeContent( $this->difftotext, $title, $model, $this->contentFormat );
'diffto' => null,
'difftotext' => null,
'contentformat' => array(
- ApiBase::PARAM_TYPE => array_values( $GLOBALS[ 'wgContentFormatMimeTypes' ] ),
+ ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats(),
ApiBase::PARAM_DFLT => null
),
);
);
}
+ public function getResultProperties() {
+ $props = array(
+ '' => array(),
+ 'ids' => array(
+ 'revid' => 'integer',
+ 'parentid' => array(
+ ApiBase::PROP_TYPE => 'integer',
+ ApiBase::PROP_NULLABLE => true
+ )
+ ),
+ 'flags' => array(
+ 'minor' => 'boolean'
+ ),
+ 'user' => array(
+ 'userhidden' => 'boolean',
+ 'user' => 'string',
+ 'anon' => 'boolean'
+ ),
+ 'userid' => array(
+ 'userhidden' => 'boolean',
+ 'userid' => 'integer',
+ 'anon' => 'boolean'
+ ),
+ 'timestamp' => array(
+ 'timestamp' => 'timestamp'
+ ),
+ 'size' => array(
+ 'size' => 'integer'
+ ),
+ 'sha1' => array(
+ 'sha1' => 'string'
+ ),
+ 'comment' => array(
+ 'commenthidden' => 'boolean',
+ 'comment' => array(
+ ApiBase::PROP_TYPE => 'string',
+ ApiBase::PROP_NULLABLE => true
+ )
+ ),
+ 'parsedcomment' => array(
+ 'commenthidden' => 'boolean',
+ 'parsedcomment' => array(
+ ApiBase::PROP_TYPE => 'string',
+ ApiBase::PROP_NULLABLE => true
+ )
+ ),
+ 'content' => array(
+ '*' => array(
+ ApiBase::PROP_TYPE => 'string',
+ ApiBase::PROP_NULLABLE => true
+ ),
+ 'texthidden' => 'boolean'
+ )
+ );
+
+ self::addTokenProperties( $props, $this->getTokenFunctions() );
+
+ return $props;
+ }
+
public function getDescription() {
return array(
'Get revision information',