(bug 2585) Image pages should send 404 if no image, no shared image and no
authorBrian Wolff <bawolff@users.mediawiki.org>
Sun, 16 Jan 2011 00:43:56 +0000 (00:43 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Sun, 16 Jan 2011 00:43:56 +0000 (00:43 +0000)
description page (To be consistant with how non-existant article pages act).

RELEASE-NOTES
includes/ImagePage.php

index 10b7495..bd8c551 100644 (file)
@@ -82,6 +82,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 26733) Wrap initial table creation in transaction
 * (bug 26729) Category pages should return 404 if they do not exist and have no
   members.
+* (bug 2585) Image pages should send 404 if no image, no shared image and no
+  description page.
 
 === API changes in 1.18 ===
 * (bug 26339) Throw warning when truncating an overlarge API result
index bf903b7..d00120f 100644 (file)
@@ -498,8 +498,16 @@ EOT
                        {
                                $nofile = 'filepage-nofile';
                        }
+                       // Note, if there is an image description page, but
+                       // no image, then this setRobotPolicy is overriden
+                       // by Article::View().
                        $wgOut->setRobotPolicy( 'noindex,nofollow' );
                        $wgOut->wrapWikiMsg( "<div id='mw-imagepage-nofile' class='plainlinks'>\n$1\n</div>", $nofile );
+                       if ( !$this->getID() ) {
+                               // If there is no image, no shared image, and no description page,
+                               // output a 404, to be consistent with articles.
+                               $wgRequest->response()->header( "HTTP/1.x 404 Not Found" );
+                       }
                }
        }