Move adjustment of revision delete target in SpecialRevisiondelete to fix fatal
authoraude <aude.wiki@gmail.com>
Fri, 25 Jul 2014 15:53:52 +0000 (17:53 +0200)
committerAude <aude.wiki@gmail.com>
Fri, 25 Jul 2014 16:00:08 +0000 (16:00 +0000)
targetObj needs to be set correctly before accessing the RevisionList,
and trying to get the 'current'.  If not set correctly, then $title
given to RevisionList (and it's subclasses) is Special:Revisiondelete
and rev_page is 0. So nothing is found for 'current' and a fatal
error happens.

Follow-up to Id1baacb

Bug: 68566
Change-Id: Ic078af5417798db1b2900057dbf7514112e94b46

includes/specials/SpecialRevisiondelete.php

index 9cec847..93df289 100644 (file)
@@ -160,6 +160,14 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                if ( !$this->typeName || count( $this->ids ) == 0 ) {
                        throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
                }
+
+               # Allow the list type to adjust the passed target
+               $this->targetObj = RevisionDeleter::suggestTarget(
+                       $this->typeName,
+                       $this->targetObj,
+                       $this->ids
+               );
+
                $this->typeLabels = self::$UILabels[$this->typeName];
                $list = $this->getList();
                $list->reset();
@@ -170,13 +178,6 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                $pageIsSuppressed = $bitfield & Revision::DELETED_RESTRICTED;
                $this->mIsAllowed = $this->mIsAllowed && !( $canViewSuppressedOnly && $pageIsSuppressed );
 
-               # Allow the list type to adjust the passed target
-               $this->targetObj = RevisionDeleter::suggestTarget(
-                       $this->typeName,
-                       $this->targetObj,
-                       $this->ids
-               );
-
                $this->otherReason = $request->getVal( 'wpReason' );
                # We need a target page!
                if ( is_null( $this->targetObj ) ) {