Handle edge case in WikiPage::lock()
[lhc/web/wiklou.git] / includes / media / MediaHandler.php
index 0103946..015eb5a 100644 (file)
@@ -180,10 +180,10 @@ abstract class MediaHandler {
        function convertMetadataVersion( $metadata, $version = 1 ) {
                if ( !is_array( $metadata ) ) {
 
-                       //unserialize to keep return parameter consistent.
-                       wfSuppressWarnings();
+                       // unserialize to keep return parameter consistent.
+                       MediaWiki\suppressWarnings();
                        $ret = unserialize( $metadata );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
 
                        return $ret;
                }
@@ -639,7 +639,7 @@ abstract class MediaHandler {
         */
        static function getGeneralLongDesc( $file ) {
                return wfMessage( 'file-info' )->sizeParams( $file->getSize() )
-                       ->params( $file->getMimeType() )->parse();
+                       ->params( '<span class="mime-type">' . $file->getMimeType() . '</span>' )->parse();
        }
 
        /**
@@ -861,4 +861,33 @@ abstract class MediaHandler {
        public function sanitizeParamsForBucketing( $params ) {
                return $params;
        }
+
+       /**
+        * Gets configuration for the file warning message. Return value of
+        * the following structure:
+        *   array(
+        *     // Required, module with messages loaded for the client
+        *     'module' => 'example.filewarning.messages',
+        *     // Required, array of names of messages
+        *     'messages' => array(
+        *       // Required, main warning message
+        *       'main' => 'example-filewarning-main',
+        *       // Optional, header for warning dialog
+        *       'header' => 'example-filewarning-header',
+        *       // Optional, footer for warning dialog
+        *       'footer' => 'example-filewarning-footer',
+        *       // Optional, text for more-information link (see below)
+        *       'info' => 'example-filewarning-info',
+        *     ),
+        *     // Optional, link for more information
+        *     'link' => 'http://example.com',
+        *   )
+        *
+        * Returns null if no warning is necessary.
+        * @param File $file
+        * @return array|null
+        */
+       public function getWarningConfig( $file ) {
+               return null;
+       }
 }