https://www.mediawiki.org/wiki/Special:Code/MediaWiki/101944
Revision: 101944
Author: brion
Date: 2011-11-04 01:31:15 +0000 (Fri, 04 Nov 2011)
Log Message:
-----------
Partial revert of r101912 -- restores r99315 'includexmlnamespace' parameter
for API, but keeps the logic to keep that from clobbering alternate XML output
formats with their own namespaces.
Modified Paths:
--------------
trunk/phase3/includes/api/ApiFormatXml.php
trunk/phase3/includes/filerepo/File.php
Modified: trunk/phase3/includes/api/ApiFormatXml.php
===================================================================
--- trunk/phase3/includes/api/ApiFormatXml.php 2011-11-04 01:30:47 UTC (rev
101943)
+++ trunk/phase3/includes/api/ApiFormatXml.php 2011-11-04 01:31:15 UTC (rev
101944)
@@ -38,6 +38,7 @@
private $mRootElemName = 'api';
public static $namespace = 'http://www.mediawiki.org/xml/api/';
private $mDoubleQuote = false;
+ private $mIncludeNamespace = false;
private $mXslt = null;
public function __construct( $main, $format ) {
@@ -59,19 +60,23 @@
public function execute() {
$params = $this->extractRequestParams();
$this->mDoubleQuote = $params['xmldoublequote'];
+ $this->mIncludeNamespace = $params['includexmlnamespace'];
$this->mXslt = $params['xslt'];
$this->printText( '<?xml version="1.0"?>' );
if ( !is_null( $this->mXslt ) ) {
$this->addXslt();
}
+ if ( $this->mIncludeNamespace ) {
+ // If the result data already contains an 'xmlns'
namespace added
+ // for custom XML output types, it will override the
one for the
+ // generic API results.
+ // This allows API output of other XML types like Atom,
RSS, RSD.
+ $data = $this->getResultData() + array( 'xmlns' =>
self::$namespace );
+ } else {
+ $data = $this->getResultData();
+ }
- // If the result data already contains an 'xmlns' namespace
added
- // for custom XML output types, it will override the one for the
- // generic API results.
- // This allows API output of other XML types like Atom, RSS,
RSD.
- $data = $this->getResultData() + array( 'xmlns' =>
self::$namespace );
-
$this->printText(
self::recXmlPrint( $this->mRootElemName,
$data,
@@ -208,6 +213,7 @@
return array(
'xmldoublequote' => false,
'xslt' => null,
+ 'includexmlnamespace' => false,
);
}
@@ -215,6 +221,7 @@
return array(
'xmldoublequote' => 'If specified, double quotes all
attributes and content',
'xslt' => 'If specified, adds <xslt> as stylesheet',
+ 'includexmlnamespace' => 'If specified, adds an XML
namespace'
);
}
Modified: trunk/phase3/includes/filerepo/File.php
===================================================================
--- trunk/phase3/includes/filerepo/File.php 2011-11-04 01:30:47 UTC (rev
101943)
+++ trunk/phase3/includes/filerepo/File.php 2011-11-04 01:31:15 UTC (rev
101944)
@@ -1476,15 +1476,18 @@
# Get size in bytes
$info['size'] = filesize( $path );
+ wfDebug("XXX $path $ext {$info[file-mime]}
{$info[mime]} {$info[major_mime]} {$info[minor_mime]} {$info[media_type]}
{$info[size]}\n");
# Height, width and metadata
$handler = MediaHandler::getHandler( $info['mime'] );
if ( $handler ) {
$tempImage = (object)array();
$info['metadata'] = $handler->getMetadata(
$tempImage, $path );
$gis = $handler->getImageSize( $tempImage,
$path, $info['metadata'] );
+ wfDebug("XXX $path has handler, metadata is
{$info[metadata]}\n");
} else {
$gis = false;
$info['metadata'] = '';
+ wfDebug("XXX $path no handler, no metadata\n");
}
$info['sha1'] = self::sha1Base36( $path );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs