X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fexport%2FWikiExporter.php;h=ca63dfebf3b5fc856cab9746c0e867a99d32de56;hb=0bb36bf5aaa72e3af0d7e47177895184f315fbb6;hp=120632c365e9216df3540fb7993e87c1abbb8185;hpb=e6d1a3793317ffd5c6bc3dfb29a9f0b8cac1d99b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/export/WikiExporter.php b/includes/export/WikiExporter.php index 120632c365..ca63dfebf3 100644 --- a/includes/export/WikiExporter.php +++ b/includes/export/WikiExporter.php @@ -83,13 +83,18 @@ class WikiExporter { * - limit: maximum number of rows to return * - dir: "asc" or "desc" timestamp order * @param int $text One of WikiExporter::TEXT or WikiExporter::STUB + * @param null|array $limitNamespaces Comma-separated list of namespace numbers + * to limit results */ - function __construct( $db, $history = self::CURRENT, $text = self::TEXT ) { + function __construct( $db, $history = self::CURRENT, $text = self::TEXT, + $limitNamespaces = null + ) { $this->db = $db; $this->history = $history; $this->writer = new XmlDumpWriter( $text, self::schemaVersion() ); $this->sink = new DumpOutput(); $this->text = $text; + $this->limitNamespaces = $limitNamespaces; } /** @@ -468,9 +473,14 @@ class WikiExporter { */ protected function outputPageStreamBatch( $results, $lastRow ) { foreach ( $results as $row ) { + if ( $this->limitNamespaces && + !in_array( $row->page_namespace, $this->limitNamespaces ) ) { + $lastRow = $row; + continue; + } if ( $lastRow === null || - $lastRow->page_namespace != $row->page_namespace || - $lastRow->page_title != $row->page_title ) { + $lastRow->page_namespace !== $row->page_namespace || + $lastRow->page_title !== $row->page_title ) { if ( $lastRow !== null ) { $output = ''; if ( $this->dumpUploads ) {