From 16088d943959219c2d02aa40b3ef43f0e76c505e Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 14 Jan 2016 21:28:47 +0100 Subject: [PATCH] ErrorAction and InfoAction fixes, are now ManagedAction --- lib/clienterroraction.php | 16 +--------------- lib/infoaction.php | 2 +- lib/servererroraction.php | 27 ++++++++------------------- 3 files changed, 10 insertions(+), 35 deletions(-) diff --git a/lib/clienterroraction.php b/lib/clienterroraction.php index c2e35e62ee..5c4ef37d18 100644 --- a/lib/clienterroraction.php +++ b/lib/clienterroraction.php @@ -64,27 +64,13 @@ class ClientErrorAction extends ErrorAction { parent::__construct($message, $code); $this->default = 400; - } - // XXX: Should these error actions even be invokable via URI? - - protected function handle() - { - parent::handle(); - - $this->code = $this->trimmed('code'); - - if (!$this->code || $code < 400 || $code > 499) { + if (!$this->code || $this->code < 400 || $this->code > 499) { $this->code = $this->default; } - - $this->message = $this->trimmed('message'); - if (!$this->message) { $this->message = "Client Error $this->code"; } - - $this->showPage(); } /** diff --git a/lib/infoaction.php b/lib/infoaction.php index f72bed59d6..27563b7efc 100644 --- a/lib/infoaction.php +++ b/lib/infoaction.php @@ -44,7 +44,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @see ErrorAction */ -class InfoAction extends Action +class InfoAction extends ManagedAction { var $message = null; diff --git a/lib/servererroraction.php b/lib/servererroraction.php index 2f9a6585c2..8ca281614b 100644 --- a/lib/servererroraction.php +++ b/lib/servererroraction.php @@ -64,31 +64,20 @@ class ServerErrorAction extends ErrorAction $this->default = 500; + if (!$this->code || $this->code < 500 || $this->code > 599) { + $this->code = $this->default; + } + + if (!$this->message) { + $this->message = "Server Error $this->code"; + } + // Server errors must be logged. $log = "ServerErrorAction: $code $message"; if ($ex) { $log .= "\n" . $ex->getTraceAsString(); } common_log(LOG_ERR, $log); - } - - // XXX: Should these error actions even be invokable via URI? - - protected function handle() - { - parent::handle(); - - $this->code = $this->trimmed('code'); - - if (!$this->code || $code < 500 || $code > 599) { - $this->code = $this->default; - } - - $this->message = $this->trimmed('message'); - - if (!$this->message) { - $this->message = "Server Error $this->code"; - } $this->showPage(); }