Merge "Pass context to FormatMetadata class on ImagePage"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 13 Mar 2015 07:01:30 +0000 (07:01 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 13 Mar 2015 07:01:30 +0000 (07:01 +0000)
1  2 
includes/filerepo/file/File.php
includes/page/ImagePage.php

@@@ -47,7 -47,7 +47,7 @@@
   *
   * @ingroup FileAbstraction
   */
 -abstract class File {
 +abstract class File implements IDBAccessObject {
        // Bitfield values akin to the Revision deletion constants
        const DELETED_FILE = 1;
        const DELETED_COMMENT = 2;
                return false;
        }
  
 +      /**
 +       * Load any lazy-loaded file object fields from source
 +       *
 +       * This is only useful when setting $flags
 +       *
 +       * Overridden by LocalFile to actually query the DB
 +       *
 +       * @param integer $flags Bitfield of File::READ_* constants
 +       */
 +      public function load( $flags = 0 ) {
 +      }
 +
        /**
         * Returns true if file exists in the repository.
         *
        }
  
        /**
+        * @param bool|IContextSource $context Context to use (optional)
         * @return bool
         */
-       function formatMetadata() {
+       function formatMetadata( $context = false ) {
                if ( !$this->getHandler() ) {
                        return false;
                }
  
-               return $this->getHandler()->formatMetadata( $this, $this->getMetadata() );
+               return $this->getHandler()->formatMetadata( $this, $context );
        }
  
        /**
                                wfDebug( "miss\n" );
                        }
                        wfDebug( "Fetching shared description from $renderUrl\n" );
 -                      $res = Http::get( $renderUrl );
 +                      $res = Http::get( $renderUrl, array(), __METHOD__ );
                        if ( $res && $this->repo->descriptionCacheExpiry > 0 ) {
                                $wgMemc->set( $key, $res, $this->repo->descriptionCacheExpiry );
                        }
                return $this->repo->getFileTimestamp( $this->getPath() );
        }
  
 +      /**
 +       * Returns the timestamp (in TS_MW format) of the last change of the description page.
 +       * Returns false if the file does not have a description page, or retrieving the timestamp
 +       * would be expensive.
 +       * @since 1.25
 +       * @return string|bool
 +       */
 +      public function getDescriptionTouched() {
 +              return false;
 +      }
 +
        /**
         * Get the SHA-1 base 36 hash of the file
         *
@@@ -140,7 -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;
@@@ -1365,6 -1365,7 +1365,6 @@@ class ImageHistoryList extends ContextS
                } else {
                        if ( $local ) {
                                $row .= Linker::userLink( $userId, $userText );
 -                              $row .= $this->msg( 'word-separator' )->escaped();
                                $row .= '<span style="white-space: nowrap;">';
                                $row .= Linker::userToolLinks( $userId, $userText );
                                $row .= '</span>';