From: madman Date: Thu, 6 Sep 2012 03:17:41 +0000 (+0000) Subject: (bug 39688) action=info displays misleading edit history for redlinks X-Git-Tag: 1.31.0-rc.0~22034 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=cbed68b994cc587b7e5b8e5b2f93447a9464c8b5;p=lhc%2Fweb%2Fwiklou.git (bug 39688) action=info displays misleading edit history for redlinks * Will not display edit history and properties for nonexistent pages * Will not display misleading page information for noncurrent revisions Change-Id: I23dd6ead555449d0810cbc64d79737654818e3e6 --- diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index b573b1addf..3adf89080a 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -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(); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index f5353b6906..c0e80307c8 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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', diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index 180538f269..981bd818ba 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -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.', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 45b24c4971..2980e66158 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -2673,6 +2673,7 @@ $wgMessageStructure = array( 'info' => array( 'pageinfo-header', 'pageinfo-title', + 'pageinfo-not-current', 'pageinfo-header-basic', 'pageinfo-header-edits', 'pageinfo-header-restrictions',