-
- /**
- * 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;
- }
- }
- }