* Removed ResourceLoaderGetStartupModules hook. (deprecated since 1.23)
* Removed getFormFields(), onSubmit() and onSuccess() from FormlessAction, as
these were meant specifically for FormAction instead.
+* Removed Action::execute().
==== Renamed classes ====
* CLDRPluralRuleConverter_Expression to CLDRPluralRuleConverterExpression
* @throws ErrorPageError
*/
abstract public function show();
-
- /**
- * Execute the action in a silent fashion: do not display anything or release any errors.
- * @return bool whether execution was successful
- */
- abstract public function execute();
}
$this->onSuccess();
}
}
-
- /**
- * @see Action::execute()
- *
- * @param array|null $data
- * @param bool $captureErrors
- * @throws ErrorPageError|Exception
- * @return bool
- */
- public function execute( array $data = null, $captureErrors = true ) {
- try {
- // Set a new context so output doesn't leak.
- $this->context = clone $this->getContext();
-
- // This will throw exceptions if there's a problem
- $this->checkCanExecute( $this->getUser() );
-
- $fields = array();
- foreach ( $this->fields as $key => $params ) {
- if ( isset( $data[$key] ) ) {
- $fields[$key] = $data[$key];
- } elseif ( isset( $params['default'] ) ) {
- $fields[$key] = $params['default'];
- } else {
- $fields[$key] = null;
- }
- }
- $status = $this->onSubmit( $fields );
- if ( $status === true ) {
- // This might do permanent stuff
- $this->onSuccess();
- return true;
- } else {
- return false;
- }
- }
- catch ( ErrorPageError $e ) {
- if ( $captureErrors ) {
- return false;
- } else {
- throw $e;
- }
- }
- }
}
$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;
- }
- }
- }
}