X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiFormatRaw.php;h=81d2f4f5627d4d56f8c83830ebcc73663be4cf9f;hb=07428db8d931f2b4ea6e3c043df924a3f4edfec1;hp=3f5c8b73841bbd0eadcb1d70897b68cfc814b6b7;hpb=926f665234e72ea5905bcb239d1f7a32b488f875;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiFormatRaw.php b/includes/api/ApiFormatRaw.php index 3f5c8b7384..81d2f4f562 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(); 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() { + public function initPrinter( $unused = false ) { + $data = $this->getResultData(); + if ( isset( $data['error'] ) ) { + $this->errorFallback->initPrinter( $unused ); + } else { + parent::initPrinter( $unused ); + } + } + + public function closePrinter() { $data = $this->getResultData(); if ( isset( $data['error'] ) ) { - $this->mErrorFallback->execute(); + $this->errorFallback->closePrinter(); + } else { + parent::closePrinter(); + } + } + public function execute() { + $data = $this->getResultData(); + if ( isset( $data['error'] ) ) { + $this->errorFallback->execute(); return; }