コード例 #1
0
 /**
  * Just like ErrorPageError::report() but additionally set
  * a 400 HTTP status code (bug 33646).
  */
 public function report()
 {
     global $wgOut;
     // bug 33646: a badtitle error page need to return an error code
     // to let mobile browser now that it is not a normal page.
     $wgOut->setStatusCode(400);
     parent::report();
 }
コード例 #2
0
 public function testReport()
 {
     $mockMessage = $this->getMockMessage();
     $title = 'Foo';
     $params = array('Baz');
     global $wgOut;
     $wgOut = $this->getMockBuilder('OutputPage')->disableOriginalConstructor()->getMock();
     $wgOut->expects($this->once())->method('showErrorPage')->with($title, $mockMessage, $params);
     $wgOut->expects($this->once())->method('output');
     $e = new ErrorPageError($title, $mockMessage, $params);
     $e->report();
 }
コード例 #3
0
ファイル: UserNotLoggedIn.php プロジェクト: paladox/mediawiki
 /**
  * Redirect to Special:Userlogin if the specified message is compatible. Otherwise,
  * show an error page as usual.
  */
 public function report()
 {
     // If an unsupported message is used, don't try redirecting to Special:Userlogin,
     // since the message may not be compatible.
     if (!in_array($this->msg, LoginHelper::getValidErrorMessages())) {
         parent::report();
     }
     // Message is valid. Redirec to Special:Userlogin
     $context = RequestContext::getMain();
     $output = $context->getOutput();
     $query = $context->getRequest()->getValues();
     // Title will be overridden by returnto
     unset($query['title']);
     // Redirect to Special:Userlogin
     $output->redirect(SpecialPage::getTitleFor('Userlogin')->getFullURL(['returnto' => $context->getTitle()->getFullText(), 'returntoquery' => wfArrayToCgi($query), 'warning' => $this->msg]));
     $output->output();
 }
コード例 #4
0
ファイル: Exception.php プロジェクト: yusufchang/app
 public function report()
 {
     global $wgOut;
     $wgOut->setStatusCode(503);
     return parent::report();
 }
コード例 #5
0
 public function report()
 {
     global $wgOut;
     $wgOut->setStatusCode(429);
     parent::report();
 }