Merge "RCFilters: Style the Saved Links placeholder and add a title"
[lhc/web/wiklou.git] / includes / filerepo / file / LocalFile.php
index a1cb0a2..8514cc8 100644 (file)
@@ -21,7 +21,9 @@
  * @ingroup FileAbstraction
  */
 
-use \MediaWiki\Logger\LoggerFactory;
+use MediaWiki\Logger\LoggerFactory;
+use Wikimedia\Rdbms\Database;
+use Wikimedia\Rdbms\IDatabase;
 
 /**
  * Class to represent a local file in the wiki's own database
@@ -391,7 +393,7 @@ class LocalFile extends File {
         * @param int $flags
         */
        function loadFromDB( $flags = 0 ) {
-               $fname = get_class( $this ) . '::' . __FUNCTION__;
+               $fname = static::class . '::' . __FUNCTION__;
 
                # Unconditionally set loaded=true, we don't want the accessors constantly rechecking
                $this->dataLoaded = true;
@@ -416,7 +418,7 @@ class LocalFile extends File {
         * This covers fields that are sometimes not cached.
         */
        protected function loadExtraFromDB() {
-               $fname = get_class( $this ) . '::' . __FUNCTION__;
+               $fname = static::class . '::' . __FUNCTION__;
 
                # Unconditionally set loaded=true, we don't want the accessors constantly rechecking
                $this->extraDataLoaded = true;
@@ -1100,7 +1102,7 @@ class LocalFile extends File {
         */
        public function nextHistoryLine() {
                # Polymorphic function name to distinguish foreign and local fetches
-               $fname = get_class( $this ) . '::' . __FUNCTION__;
+               $fname = static::class . '::' . __FUNCTION__;
 
                $dbr = $this->repo->getReplicaDB();
 
@@ -1198,7 +1200,11 @@ class LocalFile extends File {
                $options = [];
                $handler = MediaHandler::getHandler( $props['mime'] );
                if ( $handler ) {
-                       $options['headers'] = $handler->getStreamHeaders( $props['metadata'] );
+                       $metadata = MediaWiki\quietCall( 'unserialize', $props['metadata'] );
+
+                       $options['headers'] = $handler->getContentHeaders(
+                               $metadata, $props['width'], $props['height']
+                       );
                } else {
                        $options['headers'] = [];
                }