Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F7090
bug25463-2.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
•
bzimport
Nov 21 2014, 11:14 PM
2014-11-21 23:14:58 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
bug25463-2.patch
View Options
Index: includes/api/ApiQuery.php
===================================================================
--- includes/api/ApiQuery.php (revision 75547)
+++ includes/api/ApiQuery.php (working copy)
@@ -457,35 +457,45 @@
$result->addValue( 'query', 'pages', $pages );
}
if ( $this->params['export'] ) {
- $exporter = new WikiExporter( $this->getDB() );
- // WikiExporter writes to stdout, so catch its
- // output with an ob
- ob_start();
- $exporter->openStream();
- foreach ( $pageSet->getGoodTitles() as $title ) {
- if ( $title->userCanRead() ) {
+ $exportTitles = array();
+ $titles = $pageSet->getGoodTitles();
+ if( count( $titles ) ) {
+ foreach ( $titles as $title ) {
+ if ( $title->userCanRead() ) {
+ $exportTitles[] = $title;
+ }
+ }
+ }
+ //export, when there are titles
+ if( count( $exportTitles ) ) {
+ $exporter = new WikiExporter( $this->getDB() );
+ // WikiExporter writes to stdout, so catch its
+ // output with an ob
+ ob_start();
+ $exporter->openStream();
+ foreach ( $exportTitles as $title ) {
$exporter->pageByTitle( $title );
}
+ $exporter->closeStream();
+ $exportxml = ob_get_contents();
+ ob_end_clean();
+
+ // Don't check the size of exported stuff
+ // It's not continuable, so it would cause more
+ // problems than it'd solve
+ $result->disableSizeCheck();
+ if ( $this->params['exportnowrap'] ) {
+ $result->reset();
+ // Raw formatter will handle this
+ $result->addValue( null, 'text', $exportxml );
+ $result->addValue( null, 'mime', 'text/xml' );
+ } else {
+ $r = array();
+ ApiResult::setContent( $r, $exportxml );
+ $result->addValue( 'query', 'export', $r );
+ }
+ $result->enableSizeCheck();
}
- $exporter->closeStream();
- $exportxml = ob_get_contents();
- ob_end_clean();
-
- // Don't check the size of exported stuff
- // It's not continuable, so it would cause more
- // problems than it'd solve
- $result->disableSizeCheck();
- if ( $this->params['exportnowrap'] ) {
- $result->reset();
- // Raw formatter will handle this
- $result->addValue( null, 'text', $exportxml );
- $result->addValue( null, 'mime', 'text/xml' );
- } else {
- $r = array();
- ApiResult::setContent( $r, $exportxml );
- $result->addValue( 'query', 'export', $r );
- }
- $result->enableSizeCheck();
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6626
Default Alt Text
bug25463-2.patch (2 KB)
Attached To
Mode
T27463: Export header should not be shown if no pages were requested, to reduce confusion
Attached
Detach File
Event Timeline
Log In to Comment