summaryrefslogtreecommitdiff
path: root/includes/api/ApiFormatRaw.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiFormatRaw.php')
-rw-r--r--includes/api/ApiFormatRaw.php31
1 files changed, 25 insertions, 6 deletions
diff --git a/includes/api/ApiFormatRaw.php b/includes/api/ApiFormatRaw.php
index 3f5c8b73..7bb2453d 100644
--- a/includes/api/ApiFormatRaw.php
+++ b/includes/api/ApiFormatRaw.php
@@ -30,20 +30,22 @@
*/
class ApiFormatRaw extends ApiFormatBase {
+ private $errorFallback;
+
/**
* @param ApiMain $main
* @param ApiFormatBase $errorFallback Object to fall back on for errors
*/
public function __construct( ApiMain $main, ApiFormatBase $errorFallback ) {
parent::__construct( $main, 'raw' );
- $this->mErrorFallback = $errorFallback;
+ $this->errorFallback = $errorFallback;
}
public function getMimeType() {
- $data = $this->getResultData();
+ $data = $this->getResult()->getResultData();
if ( isset( $data['error'] ) ) {
- return $this->mErrorFallback->getMimeType();
+ return $this->errorFallback->getMimeType();
}
if ( !isset( $data['mime'] ) ) {
@@ -53,11 +55,28 @@ class ApiFormatRaw extends ApiFormatBase {
return $data['mime'];
}
- public function execute() {
- $data = $this->getResultData();
+ public function initPrinter( $unused = false ) {
+ $data = $this->getResult()->getResultData();
+ if ( isset( $data['error'] ) ) {
+ $this->errorFallback->initPrinter( $unused );
+ } else {
+ parent::initPrinter( $unused );
+ }
+ }
+
+ public function closePrinter() {
+ $data = $this->getResult()->getResultData();
if ( isset( $data['error'] ) ) {
- $this->mErrorFallback->execute();
+ $this->errorFallback->closePrinter();
+ } else {
+ parent::closePrinter();
+ }
+ }
+ public function execute() {
+ $data = $this->getResult()->getResultData();
+ if ( isset( $data['error'] ) ) {
+ $this->errorFallback->execute();
return;
}