Merge "Update list item newline handling to follow Parsoid's model"
[lhc/web/wiklou.git] / includes / media / MediaHandler.php
index ab8fa14..efc02fe 100644 (file)
@@ -573,32 +573,27 @@ abstract class MediaHandler {
        }
 
        /**
-        * Used instead of getLongDesc if there is no handler registered for file.
+        * Short description. Shown on Special:Search results.
         *
         * @param File $file
         * @return string
         */
        function getShortDesc( $file ) {
-               global $wgLang;
-
-               return htmlspecialchars( $wgLang->formatSize( $file->getSize() ) );
+               return self::getGeneralShortDesc( $file );
        }
 
        /**
-        * Short description. Shown on Special:Search results.
+        * Long description. Shown under image on image description page surounded by ().
         *
         * @param File $file
         * @return string
         */
        function getLongDesc( $file ) {
-               global $wgLang;
-
-               return wfMessage( 'file-info', htmlspecialchars( $wgLang->formatSize( $file->getSize() ) ),
-                       $file->getMimeType() )->parse();
+               return self::getGeneralLongDesc( $file );
        }
 
        /**
-        * Long description. Shown under image on image description page surounded by ().
+        * Used instead of getShortDesc if there is no handler registered for file.
         *
         * @param File $file
         * @return string
@@ -606,20 +601,18 @@ abstract class MediaHandler {
        static function getGeneralShortDesc( $file ) {
                global $wgLang;
 
-               return $wgLang->formatSize( $file->getSize() );
+               return htmlspecialchars( $wgLang->formatSize( $file->getSize() ) );
        }
 
        /**
-        * Used instead of getShortDesc if there is no handler registered for file.
+        * Used instead of getLongDesc if there is no handler registered for file.
         *
         * @param File $file
         * @return string
         */
        static function getGeneralLongDesc( $file ) {
-               global $wgLang;
-
-               return wfMessage( 'file-info', $wgLang->formatSize( $file->getSize() ),
-                       $file->getMimeType() )->parse();
+               return wfMessage( 'file-info' )->sizeParams( $file->getSize() )
+                       ->params( $file->getMimeType() )->parse();
        }
 
        /**
@@ -812,4 +805,13 @@ abstract class MediaHandler {
        public function getLength( $file ) {
                return 0.0;
        }
+
+       /**
+        * True if creating thumbnails from the file is large or otherwise resource-intensive.
+        * @param File $file
+        * @return bool
+        */
+       public function isExpensiveToThumbnail( $file ) {
+               return false;
+       }
 }