Rename WikiPage::isParserCacheUsed to WikiPage::shouldCheckParserCache
[lhc/web/wiklou.git] / includes / page / ImagePage.php
index 855f233..7ea4ed7 100644 (file)
@@ -140,7 +140,7 @@ class ImagePage extends Article {
 
                if ( $wgShowEXIF && $this->displayImg->exists() ) {
                        // @todo FIXME: Bad interface, see note on MediaHandler::formatMetadata().
-                       $formattedMetadata = $this->displayImg->formatMetadata();
+                       $formattedMetadata = $this->displayImg->formatMetadata( $this->getContext() );
                        $showmeta = $formattedMetadata !== false;
                } else {
                        $showmeta = false;
@@ -505,6 +505,22 @@ class ImagePage extends Article {
 
                        $longDesc = $this->getContext()->msg( 'parentheses', $this->displayImg->getLongDesc() )->text();
 
+                       $handler = $this->displayImg->getHandler();
+
+                       // If this is a filetype with potential issues, warn the user.
+                       if ( $handler ) {
+                               $warningConfig = $handler->getWarningConfig( $this->displayImg );
+
+                               if ( $warningConfig !== null ) {
+                                       // The warning will be displayed via CSS and JavaScript.
+                                       // We just need to tell the client side what message to use.
+                                       $output = $this->getContext()->getOutput();
+                                       $output->addJsConfigVars( 'wgFileWarning', $warningConfig );
+                                       $output->addModules( $warningConfig['module'] );
+                                       $output->addModules( 'mediawiki.filewarning' );
+                               }
+                       }
+
                        $medialink = "[[Media:$filename|$linktext]]";
 
                        if ( !$this->displayImg->isSafeFile() ) {
@@ -598,8 +614,8 @@ EOT
                        $out->wrapWikiMsg( "<div id='mw-imagepage-nofile' class='plainlinks'>\n$1\n</div>", $nofile );
                        if ( !$this->getID() && $wgSend404Code ) {
                                // If there is no image, no shared image, and no description page,
-                               // output a 404, to be consistent with articles.
-                               $request->response()->header( 'HTTP/1.1 404 Not Found' );
+                               // output a 404, to be consistent with Article::showMissingArticle.
+                               $request->response()->statusHeader( 404 );
                        }
                }
                $out->setFileVersion( $this->displayImg );
@@ -1499,6 +1515,18 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
                $s = '';
                $this->doQuery();
                if ( count( $this->mHist ) ) {
+                       if ( $this->mImg->isLocal() ) {
+                               // Do a batch existence check for user pages and talkpages
+                               $linkBatch = new LinkBatch();
+                               for ( $i = $this->mRange[0]; $i <= $this->mRange[1]; $i++ ) {
+                                       $file = $this->mHist[$i];
+                                       $user = $file->getUser( 'text' );
+                                       $linkBatch->add( NS_USER, $user );
+                                       $linkBatch->add( NS_USER_TALK, $user );
+                               }
+                               $linkBatch->execute();
+                       }
+
                        $list = new ImageHistoryList( $this->mImagePage );
                        # Generate prev/next links
                        $navLink = $this->getNavigationBar();