Merge "Type hint against LinkTarget in WatchedItemStore"
[lhc/web/wiklou.git] / includes / api / ApiQuery.php
index 0c89c1e..bdb0dc2 100644 (file)
@@ -430,10 +430,9 @@ class ApiQuery extends ApiBase {
                $exportTitles = [];
                $titles = $pageSet->getGoodTitles();
                if ( count( $titles ) ) {
-                       $user = $this->getUser();
                        /** @var Title $title */
                        foreach ( $titles as $title ) {
-                               if ( $title->userCan( 'read', $user ) ) {
+                               if ( $this->getPermissionManager()->userCan( 'read', $this->getUser(), $title ) ) {
                                        $exportTitles[] = $title;
                                }
                        }
@@ -442,6 +441,7 @@ class ApiQuery extends ApiBase {
                $exporter = new WikiExporter( $this->getDB() );
                $sink = new DumpStringOutput;
                $exporter->setOutputSink( $sink );
+               $exporter->setSchemaVersion( $this->mParams['exportschema'] );
                $exporter->openStream();
                foreach ( $exportTitles as $title ) {
                        $exporter->pageByTitle( $title );
@@ -480,6 +480,10 @@ class ApiQuery extends ApiBase {
                        'indexpageids' => false,
                        'export' => false,
                        'exportnowrap' => false,
+                       'exportschema' => [
+                               ApiBase::PARAM_DFLT => WikiExporter::schemaVersion(),
+                               ApiBase::PARAM_TYPE => XmlDumpWriter::$supportedSchemas,
+                       ],
                        'iwurl' => false,
                        'continue' => [
                                ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',