Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -511,6 +511,17 @@ |
512 | 512 | } |
513 | 513 | |
514 | 514 | /** |
| 515 | + * Checks if userCanExecute, and if not throws a PermissionsError |
| 516 | + * |
| 517 | + * @since 1.19 |
| 518 | + */ |
| 519 | + public function checkPermissions() { |
| 520 | + if ( !$this->userCanExecute( $this->getUser() ) ) { |
| 521 | + $this->displayRestrictionError(); |
| 522 | + } |
| 523 | + } |
| 524 | + |
| 525 | + /** |
515 | 526 | * Sets headers - this should be called from the execute() method of all derived classes! |
516 | 527 | */ |
517 | 528 | function setHeaders() { |
— | — | @@ -530,18 +541,15 @@ |
531 | 542 | */ |
532 | 543 | function execute( $par ) { |
533 | 544 | $this->setHeaders(); |
| 545 | + $this->checkPermissions(); |
534 | 546 | |
535 | | - if ( $this->userCanExecute( $this->getUser() ) ) { |
536 | | - $func = $this->mFunction; |
537 | | - // only load file if the function does not exist |
538 | | - if( !is_callable($func) && $this->mFile ) { |
539 | | - require_once( $this->mFile ); |
540 | | - } |
541 | | - $this->outputHeader(); |
542 | | - call_user_func( $func, $par, $this ); |
543 | | - } else { |
544 | | - $this->displayRestrictionError(); |
| 547 | + $func = $this->mFunction; |
| 548 | + // only load file if the function does not exist |
| 549 | + if( !is_callable($func) && $this->mFile ) { |
| 550 | + require_once( $this->mFile ); |
545 | 551 | } |
| 552 | + $this->outputHeader(); |
| 553 | + call_user_func( $func, $par, $this ); |
546 | 554 | } |
547 | 555 | |
548 | 556 | /** |