r36816 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36815‎ | r36816 | r36817 >
Date:14:46, 30 June 2008
Author:demon
Status:old
Tags:
Comment:
Add $wgAdditionalXMLTypes, an array of XML mimetypes we can check for with MimeMagic.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/MimeMagic.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/MimeMagic.php
@@ -457,6 +457,7 @@
458458 */
459459 $xml = new XmlTypeCheck( $file );
460460 if( $xml->wellFormed ) {
 461+ global $wgAdditionalXMLTypes;
461462 $types = array(
462463 'http://www.w3.org/2000/svg:svg' => 'image/svg+xml',
463464 'svg' => 'image/svg+xml',
@@ -464,11 +465,12 @@
465466 'http://www.w3.org/1999/xhtml:html' => 'text/html', // application/xhtml+xml?
466467 'html' => 'text/html', // application/xhtml+xml?
467468 );
 469+
468470 if( isset( $types[$xml->rootElement] ) ) {
469 - $mime = $types[$xml->rootElement];
470 - return $mime;
 471+ return $types[$xml->rootElement];
 472+ } elseif( isset( $wgAdditionalXMLTypes[$xml->rootElement] ) ) {
 473+ return $wgAdditionalXMLTypes[$xml->rootElement];
471474 } else {
472 - /// Fixme -- this would be the place to allow additional XML type checks
473475 return 'application/xml';
474476 }
475477 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -367,6 +367,11 @@
368368 $wgTrivialMimeDetection= false;
369369
370370 /**
 371+ * Additional XML types we can allow via mime-detection.
 372+ */
 373+$wgAdditionalXMLTypes = array();
 374+
 375+/**
371376 * To set 'pretty' URL paths for actions other than
372377 * plain page views, add to this array. For instance:
373378 * 'edit' => "$wgScriptPath/edit/$1"
Index: trunk/phase3/RELEASE-NOTES
@@ -64,6 +64,8 @@
6565 previously it was choosen based on $wgParserCacheType
6666 * $wgExtensionAliasesFiles option to simplify adding aliases to special pages
6767 provided by extensions, in a similar way to $wgExtensionMessagesFiles
 68+* Added $wgAdditionalXMLTypes, an array of XML mimetypes we can check for
 69+ with MimeMagic.
6870
6971 === New features in 1.13 ===
7072

Follow-up revisions

RevisionCommit summaryAuthorDate
r36958Revert r36816 for the moment (Add $wgAdditionalXMLTypes, an array of XML mime...brion23:07, 2 July 2008

Status & tagging log