Made isAllowed(), showHistory() and formatRevisionRow() protected to allow for easier...
authorJack Phoenix <jack@countervandalism.net>
Sun, 24 May 2015 18:58:31 +0000 (21:58 +0300)
committerJack Phoenix <jack@countervandalism.net>
Sun, 24 May 2015 18:58:31 +0000 (21:58 +0300)
The Video extension adds video support to Special:Undelete by subclassing
the SpecialUndelete class so that end-users don't need to hack core.
Currently Video's SpecialUndeleteWithVideoSupport.php duplicates
significant chunks of core SpecialUndelete.php because many
SpecialUndelete methods are private.

Change-Id: Ieec6c297011f2b50027840abd335b9efd54f2158

includes/specials/SpecialUndelete.php

index f2362a1..8a66273 100644 (file)
@@ -756,7 +756,7 @@ class SpecialUndelete extends SpecialPage {
         * @param User $user
         * @return bool
         */
-       private function isAllowed( $permission, User $user = null ) {
+       protected function isAllowed( $permission, User $user = null ) {
                $user = $user ? : $this->getUser();
                if ( $this->mTargetObj !== null ) {
                        return $this->mTargetObj->userCan( $permission, $user );
@@ -1206,7 +1206,7 @@ class SpecialUndelete extends SpecialPage {
                $repo->streamFile( $path );
        }
 
-       private function showHistory() {
+       protected function showHistory() {
                $out = $this->getOutput();
                if ( $this->mAllowed ) {
                        $out->addModules( 'mediawiki.special.undelete' );
@@ -1377,7 +1377,7 @@ class SpecialUndelete extends SpecialPage {
                return true;
        }
 
-       private function formatRevisionRow( $row, $earliestLiveTime, $remaining ) {
+       protected function formatRevisionRow( $row, $earliestLiveTime, $remaining ) {
                $rev = Revision::newFromArchiveRow( $row,
                        array(
                                'title' => $this->mTargetObj