Index: trunk/phase3/includes/api/ApiQuery.php |
— | — | @@ -383,9 +383,7 @@ |
384 | 384 | $result->addValue( 'query', 'redirects', $redirValues ); |
385 | 385 | } |
386 | 386 | |
387 | | - // |
388 | 387 | // Missing revision elements |
389 | | - // |
390 | 388 | $missingRevIDs = $pageSet->getMissingRevisionIDs(); |
391 | 389 | if ( count( $missingRevIDs ) ) { |
392 | 390 | $revids = array(); |
— | — | @@ -398,9 +396,7 @@ |
399 | 397 | $result->addValue( 'query', 'badrevids', $revids ); |
400 | 398 | } |
401 | 399 | |
402 | | - // |
403 | 400 | // Page elements |
404 | | - // |
405 | 401 | $pages = array(); |
406 | 402 | |
407 | 403 | // Report any missing titles |
— | — | @@ -457,48 +453,57 @@ |
458 | 454 | $result->addValue( 'query', 'pages', $pages ); |
459 | 455 | } |
460 | 456 | if ( $this->params['export'] ) { |
461 | | - $exportTitles = array(); |
462 | | - $titles = $pageSet->getGoodTitles(); |
463 | | - if( count( $titles ) ) { |
464 | | - foreach ( $titles as $title ) { |
465 | | - if ( $title->userCanRead() ) { |
466 | | - $exportTitles[] = $title; |
467 | | - } |
| 457 | + $this->doExport( $pageSet, $result ); |
| 458 | + } |
| 459 | + } |
| 460 | + |
| 461 | + /** |
| 462 | + * @param $pageSet ApiPageSet |
| 463 | + * @param $result ApiResult |
| 464 | + * @return |
| 465 | + */ |
| 466 | + private function doExport( $pageSet, $result ) { |
| 467 | + $exportTitles = array(); |
| 468 | + $titles = $pageSet->getGoodTitles(); |
| 469 | + if( count( $titles ) ) { |
| 470 | + foreach ( $titles as $title ) { |
| 471 | + if ( $title->userCanRead() ) { |
| 472 | + $exportTitles[] = $title; |
468 | 473 | } |
469 | 474 | } |
470 | | - //export, when there are titles |
471 | | - if ( !count( $exportTitles ) ) { |
472 | | - return; |
473 | | - } |
| 475 | + } |
| 476 | + // only export when there are titles |
| 477 | + if ( !count( $exportTitles ) ) { |
| 478 | + return; |
| 479 | + } |
474 | 480 | |
475 | | - $exporter = new WikiExporter( $this->getDB() ); |
476 | | - // WikiExporter writes to stdout, so catch its |
477 | | - // output with an ob |
478 | | - ob_start(); |
479 | | - $exporter->openStream(); |
480 | | - foreach ( $exportTitles as $title ) { |
481 | | - $exporter->pageByTitle( $title ); |
482 | | - } |
483 | | - $exporter->closeStream(); |
484 | | - $exportxml = ob_get_contents(); |
485 | | - ob_end_clean(); |
| 481 | + $exporter = new WikiExporter( $this->getDB() ); |
| 482 | + // WikiExporter writes to stdout, so catch its |
| 483 | + // output with an ob |
| 484 | + ob_start(); |
| 485 | + $exporter->openStream(); |
| 486 | + foreach ( $exportTitles as $title ) { |
| 487 | + $exporter->pageByTitle( $title ); |
| 488 | + } |
| 489 | + $exporter->closeStream(); |
| 490 | + $exportxml = ob_get_contents(); |
| 491 | + ob_end_clean(); |
486 | 492 | |
487 | | - // Don't check the size of exported stuff |
488 | | - // It's not continuable, so it would cause more |
489 | | - // problems than it'd solve |
490 | | - $result->disableSizeCheck(); |
491 | | - if ( $this->params['exportnowrap'] ) { |
492 | | - $result->reset(); |
493 | | - // Raw formatter will handle this |
494 | | - $result->addValue( null, 'text', $exportxml ); |
495 | | - $result->addValue( null, 'mime', 'text/xml' ); |
496 | | - } else { |
497 | | - $r = array(); |
498 | | - ApiResult::setContent( $r, $exportxml ); |
499 | | - $result->addValue( 'query', 'export', $r ); |
500 | | - } |
501 | | - $result->enableSizeCheck(); |
| 493 | + // Don't check the size of exported stuff |
| 494 | + // It's not continuable, so it would cause more |
| 495 | + // problems than it'd solve |
| 496 | + $result->disableSizeCheck(); |
| 497 | + if ( $this->params['exportnowrap'] ) { |
| 498 | + $result->reset(); |
| 499 | + // Raw formatter will handle this |
| 500 | + $result->addValue( null, 'text', $exportxml ); |
| 501 | + $result->addValue( null, 'mime', 'text/xml' ); |
| 502 | + } else { |
| 503 | + $r = array(); |
| 504 | + ApiResult::setContent( $r, $exportxml ); |
| 505 | + $result->addValue( 'query', 'export', $r ); |
502 | 506 | } |
| 507 | + $result->enableSizeCheck(); |
503 | 508 | } |
504 | 509 | |
505 | 510 | /** |
Index: trunk/phase3/includes/api/ApiRsd.php |
— | — | @@ -41,7 +41,6 @@ |
42 | 42 | |
43 | 43 | public function execute() { |
44 | 44 | $result = $this->getResult(); |
45 | | - |
46 | 45 | |
47 | 46 | $result->addValue( null, 'version', '1.0' ); |
48 | 47 | $result->addValue( null, 'xmlns', 'http://archipelago.phrasewise.com/rsd' ); |