From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/api/ApiImport.php | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'includes/api/ApiImport.php') diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index 1b5153f9..a1e5709a 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -1,10 +1,10 @@ .@home.nl + * 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 @@ -42,13 +42,14 @@ class ApiImport extends ApiBase { public function execute() { global $wgUser; - if ( !$wgUser->isAllowed( 'import' ) ) { - $this->dieUsageMsg( array( 'cantimport' ) ); - } + $params = $this->extractRequestParams(); $isUpload = false; if ( isset( $params['interwikisource'] ) ) { + if ( !$wgUser->isAllowed( 'import' ) ) { + $this->dieUsageMsg( 'cantimport' ); + } if ( !isset( $params['interwikipage'] ) ) { $this->dieUsageMsg( array( 'missingparam', 'interwikipage' ) ); } @@ -61,7 +62,7 @@ class ApiImport extends ApiBase { } else { $isUpload = true; if ( !$wgUser->isAllowed( 'importupload' ) ) { - $this->dieUsageMsg( array( 'cantimport-upload' ) ); + $this->dieUsageMsg( 'cantimport-upload' ); } $source = ImportStreamSource::newFromUpload( 'xml' ); } @@ -87,8 +88,9 @@ class ApiImport extends ApiBase { } $resultData = $reporter->getData(); - $this->getResult()->setIndexedTagName( $resultData, 'page' ); - $this->getResult()->addValue( null, $this->getModuleName(), $resultData ); + $result = $this->getResult(); + $result->setIndexedTagName( $resultData, 'page' ); + $result->addValue( null, $this->getModuleName(), $resultData ); } public function mustBePosted() { @@ -131,7 +133,11 @@ class ApiImport extends ApiBase { } public function getDescription() { - return 'Import a page from another wiki, or an XML file'; + return array( + 'Import a page from another wiki, or an XML file.' , + 'Note that the HTTP POST must be done as a file upload (i.e. using multipart/form-data) when', + 'sending a file for the "xml" parameter.' + ); } public function getPossibleErrors() { @@ -159,8 +165,12 @@ class ApiImport extends ApiBase { ); } + public function getHelpUrls() { + return 'https://www.mediawiki.org/wiki/API:Import'; + } + public function getVersion() { - return __CLASS__ . ': $Id: ApiImport.php 77800 2010-12-05 14:22:49Z ialex $'; + return __CLASS__ . ': $Id: ApiImport.php 104449 2011-11-28 15:52:04Z reedy $'; } } @@ -171,6 +181,14 @@ class ApiImport extends ApiBase { class ApiImportReporter extends ImportReporter { private $mResultArr = array(); + /** + * @param $title Title + * @param $origTitle Title + * @param $revisionCount int + * @param $successCount int + * @param $pageInfo + * @return void + */ function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) { // Add a result entry $r = array(); -- cgit v1.2.3-54-g00ecf