X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Factions%2FFormlessAction.php;h=a6f1e2957dd83f44fa5224d3f85321ce8ce18813;hb=1d9fd23ab3583788fb2e3ae8e641cf83b09ef8df;hp=6cab4d1d04ce45f1eec9934b6f475abe0f25dc84;hpb=cb78f7f82018d415073d021a13bfa6a999f0dcdb;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/actions/FormlessAction.php b/includes/actions/FormlessAction.php index 6cab4d1d04..a6f1e2957d 100644 --- a/includes/actions/FormlessAction.php +++ b/includes/actions/FormlessAction.php @@ -17,47 +17,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * * @file - */ - -/** - * @defgroup Actions Action done on pages + * @ingroup Actions */ /** * An action which just does something, without showing a form first. + * + * @ingroup Actions */ abstract class FormlessAction extends Action { /** * Show something on GET request. - * @return String|null will be added to the HTMLForm if present, or just added to the + * @return string|null Will be added to the HTMLForm if present, or just added to the * output if not. Return null to not add anything */ abstract public function onView(); - /** - * We don't want an HTMLForm - * @return bool - */ - protected function getFormFields() { - return false; - } - - /** - * @param $data Array - * @return bool - */ - public function onSubmit( $data ) { - return false; - } - - /** - * @return bool - */ - public function onSuccess() { - return false; - } - public function show() { $this->setHeaders(); @@ -66,35 +42,4 @@ abstract class FormlessAction extends Action { $this->getOutput()->addHTML( $this->onView() ); } - - /** - * Execute the action silently, not giving any output. Since these actions don't have - * forms, they probably won't have any data, but some (eg rollback) may do - * @param array $data values that would normally be in the GET request - * @param bool $captureErrors whether to catch exceptions and just return false - * @throws ErrorPageError|Exception - * @return Bool whether execution was successful - */ - public function execute( array $data = null, $captureErrors = true ) { - try { - // Set a new context so output doesn't leak. - $this->context = clone $this->getContext(); - if ( is_array( $data ) ) { - $this->context->setRequest( new FauxRequest( $data, false ) ); - } - - // This will throw exceptions if there's a problem - $this->checkCanExecute( $this->getUser() ); - - $this->onView(); - return true; - } - catch ( ErrorPageError $e ) { - if ( $captureErrors ) { - return false; - } else { - throw $e; - } - } - } }