Exemple #1
0
 /**
  * Check POST for external response and setup result printer
  * @param $module ApiBase An Api module
  * @param $params Array an array with the request parameters
  */
 protected function setupExternalResponse($module, $params)
 {
     // Ignore mustBePosted() for internal calls
     if ($module->mustBePosted() && !$this->mRequest->wasPosted()) {
         $this->dieUsageMsg(array('mustbeposted', $this->mAction));
     }
     // See if custom printer is used
     $this->mPrinter = $module->getCustomPrinter();
     if (is_null($this->mPrinter)) {
         // Create an appropriate printer
         $this->mPrinter = $this->createPrinterByName($params['format']);
     }
     if ($this->mPrinter->getNeedsRawData()) {
         $this->getResult()->setRawMode();
     }
 }
 /**
  * Check POST for external response and setup result printer
  * @param ApiBase $module An Api module
  * @param array $params An array with the request parameters
  */
 protected function setupExternalResponse($module, $params)
 {
     if (!$this->getRequest()->wasPosted() && $module->mustBePosted()) {
         // Module requires POST. GET request might still be allowed
         // if $wgDebugApi is true, otherwise fail.
         $this->dieUsageMsgOrDebug(array('mustbeposted', $this->mAction));
     }
     // See if custom printer is used
     $this->mPrinter = $module->getCustomPrinter();
     if (is_null($this->mPrinter)) {
         // Create an appropriate printer
         $this->mPrinter = $this->createPrinterByName($params['format']);
     }
     if ($this->mPrinter->getNeedsRawData()) {
         $this->getResult()->setRawMode();
     }
 }