(bug 39688) action=info displays misleading edit history for redlinks
authormadman <madman.enwiki@gmail.com>
Thu, 6 Sep 2012 03:17:41 +0000 (03:17 +0000)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Sun, 14 Oct 2012 11:34:23 +0000 (13:34 +0200)
* Will not display edit history and properties for nonexistent pages
* Will not display misleading page information for noncurrent revisions

Change-Id: I23dd6ead555449d0810cbc64d79737654818e3e6

includes/actions/InfoAction.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/language/messages.inc

index b573b1a..3adf890 100644 (file)
@@ -58,6 +58,22 @@ class InfoAction extends FormlessAction {
        public function onView() {
                $content = '';
 
+               // Validate revision
+               $oldid = $this->page->getOldID();
+               if ( $oldid ) {
+                       $revision = $this->page->getRevisionFetched();
+
+                       // Revision is missing
+                       if ( $revision === null ) {
+                               return $this->msg( 'missing-revision', $oldid )->parse();
+                       }
+
+                       // Revision is not current
+                       if ( !$revision->isCurrent() ) {
+                               return $this->msg( 'pageinfo-not-current' )->plain();
+                       }
+               }
+
                // Page header
                if ( !$this->msg( 'pageinfo-header' )->isDisabled() ) {
                        $content .= $this->msg( 'pageinfo-header' )->parse();
@@ -281,6 +297,10 @@ class InfoAction extends FormlessAction {
                        );
                }
 
+               if ( !$this->page->exists() ) {
+                       return $pageInfo;
+               }
+
                // Edit history
                $pageInfo['header-edits'] = array();
 
index f5353b6..c0e8030 100644 (file)
@@ -3737,6 +3737,7 @@ This is probably caused by a link to a blacklisted external site.',
 # Info page
 'pageinfo-header'              => '-', # do not translate or duplicate this message to other languages
 'pageinfo-title'               => 'Information for "$1"',
+'pageinfo-not-current'         => 'Information may only be displayed for the current revision.',
 'pageinfo-header-basic'        => 'Basic information',
 'pageinfo-header-edits'        => 'Edit history',
 'pageinfo-header-restrictions' => 'Page protection',
index 180538f..981bd81 100644 (file)
@@ -3511,6 +3511,7 @@ See also {{msg-mw|Anonuser}} and {{msg-mw|Siteusers}}.',
 # Info page
 'pageinfo-title' => 'Page title for action=info. Parameters:
 * $1 is the page name',
+'pageinfo-not-current' => 'Error message displayed when information for an old revision is requested.',
 'pageinfo-header-basic' => 'Table section header in action=info.',
 'pageinfo-header-edits' => 'Table section header in action=info.',
 'pageinfo-header-restrictions' => 'Table section header in action=info.',
index 45b24c4..2980e66 100644 (file)
@@ -2673,6 +2673,7 @@ $wgMessageStructure = array(
        'info' => array(
                'pageinfo-header',
                'pageinfo-title',
+               'pageinfo-not-current',
                'pageinfo-header-basic',
                'pageinfo-header-edits',
                'pageinfo-header-restrictions',