From: Sam Reed Date: Wed, 27 Oct 2010 15:42:32 +0000 (+0000) Subject: * (bug 25463) Export header should not be shown if no pages were requested, to reduce... X-Git-Tag: 1.31.0-rc.0~34264 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=f1335b34bf090210d84a02b259e77ebed7504ac0;p=lhc%2Fweb%2Fwiklou.git * (bug 25463) Export header should not be shown if no pages were requested, to reduce confusion Patch by Umherirrender, with a tweak to inverse logic to reduce nesting --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2cbc5b1dc1..11393a613b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -449,6 +449,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN used, rvlimit is enforced to 1. * If a action=parse request provides an oldid that is actually the current revision id, try the parser cache, and save it to it if necessary +* (bug 25463) Export header should not be shown if no pages were requested, to + reduce confusion === Languages updated in 1.17 === diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index 4f2a1cf9c8..40c5d4f547 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -457,15 +457,27 @@ class ApiQuery extends ApiBase { $result->addValue( 'query', 'pages', $pages ); } if ( $this->params['export'] ) { + $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 ) ) { + return; + } + $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() ) { - $exporter->pageByTitle( $title ); - } + foreach ( $exportTitles as $title ) { + $exporter->pageByTitle( $title ); } $exporter->closeStream(); $exportxml = ob_get_contents();