From 63601400e476c6cf43d985f3e7b9864681695ed4 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Jan 2013 16:46:04 +0100 Subject: Update to MediaWiki 1.20.2 this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024 --- includes/api/ApiImport.php | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'includes/api/ApiImport.php') diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index ade9f1f3..637c1fff 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -4,7 +4,7 @@ * * Created on Feb 4, 2009 * - * Copyright © 2009 Roan Kattouw .@gmail.com + * Copyright © 2009 Roan Kattouw ".@gmail.com" * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -68,6 +68,12 @@ class ApiImport extends ApiBase { if ( isset( $params['namespace'] ) ) { $importer->setTargetNamespace( $params['namespace'] ); } + if ( isset( $params['rootpage'] ) ) { + $statusRootPage = $importer->setTargetRootPage( $params['rootpage'] ); + if( !$statusRootPage->isGood() ) { + $this->dieUsageMsg( $statusRootPage->getErrorsArray() ); + } + } $reporter = new ApiImportReporter( $importer, $isUpload, @@ -98,7 +104,10 @@ class ApiImport extends ApiBase { public function getAllowedParams() { global $wgImportSources; return array( - 'token' => null, + 'token' => array( + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_REQUIRED => true + ), 'summary' => null, 'xml' => null, 'interwikisource' => array( @@ -109,7 +118,8 @@ class ApiImport extends ApiBase { 'templates' => false, 'namespace' => array( ApiBase::PARAM_TYPE => 'namespace' - ) + ), + 'rootpage' => null, ); } @@ -123,6 +133,18 @@ class ApiImport extends ApiBase { 'fullhistory' => 'For interwiki imports: import the full history, not just the current version', 'templates' => 'For interwiki imports: import all included templates as well', 'namespace' => 'For interwiki imports: import to this namespace', + 'rootpage' => 'Import as subpage of this page', + ); + } + + public function getResultProperties() { + return array( + ApiBase::PROP_LIST => true, + '' => array( + 'ns' => 'namespace', + 'title' => 'string', + 'revisions' => 'integer' + ) ); } @@ -141,6 +163,8 @@ class ApiImport extends ApiBase { array( 'cantimport-upload' ), array( 'import-unknownerror', 'source' ), array( 'import-unknownerror', 'result' ), + array( 'import-rootpage-nosubpage', 'namespace' ), + array( 'import-rootpage-invalid' ), ) ); } @@ -186,8 +210,16 @@ class ApiImportReporter extends ImportReporter { function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) { // Add a result entry $r = array(); - ApiQueryBase::addTitleInfo( $r, $title ); - $r['revisions'] = intval( $successCount ); + + if ( $title === null ) { + # Invalid or non-importable title + $r['title'] = $pageInfo['title']; + $r['invalid'] = ''; + } else { + ApiQueryBase::addTitleInfo( $r, $title ); + $r['revisions'] = intval( $successCount ); + } + $this->mResultArr[] = $r; // Piggyback on the parent to do the logging -- cgit v1.2.3-54-g00ecf