diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
commit | 1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch) | |
tree | f1fdd326034e05177596851be6a7127615d81498 /includes/api/ApiFormatRaw.php | |
parent | 9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff) | |
parent | f6d65e533c62f6deb21342d4901ece24497b433e (diff) |
Merge commit 'f6d65'
# Conflicts:
# skins/ArchLinux/ArchLinux.php
Diffstat (limited to 'includes/api/ApiFormatRaw.php')
-rw-r--r-- | includes/api/ApiFormatRaw.php | 31 |
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; } |