(bug 39688) action=info displays misleading edit history for redlinks
[lhc/web/wiklou.git] / includes / actions / InfoAction.php
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();