Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -522,6 +522,18 @@ |
523 | 523 | } |
524 | 524 | |
525 | 525 | /** |
| 526 | + * If the wiki is currently in readonly mode, throws a ReadOnlyError |
| 527 | + * |
| 528 | + * @since 1.19 |
| 529 | + * @throws ReadOnlyError |
| 530 | + */ |
| 531 | + public function checkReadOnly() { |
| 532 | + if ( wfReadOnly() ) { |
| 533 | + throw new ReadOnlyError; |
| 534 | + } |
| 535 | + } |
| 536 | + |
| 537 | + /** |
526 | 538 | * Sets headers - this should be called from the execute() method of all derived classes! |
527 | 539 | */ |
528 | 540 | function setHeaders() { |
— | — | @@ -816,13 +828,11 @@ |
817 | 829 | * @throws ErrorPageError |
818 | 830 | */ |
819 | 831 | protected function checkExecutePermissions( User $user ) { |
820 | | - if ( $this->requiresWrite() && wfReadOnly() ) { |
821 | | - throw new ReadOnlyError(); |
| 832 | + if ( $this->requiresWrite() ) { |
| 833 | + $this->checkReadOnly(); |
822 | 834 | } |
823 | 835 | |
824 | | - if ( !$this->userCanExecute( $this->getUser() ) ) { |
825 | | - throw new PermissionsError( $this->getRestriction() ); |
826 | | - } |
| 836 | + $this->checkPermissions(); |
827 | 837 | |
828 | 838 | if ( $this->requiresUnblock() && $user->isBlocked() ) { |
829 | 839 | $block = $user->mBlock; |