summaryrefslogtreecommitdiff
path: root/includes/api/ApiImport.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /includes/api/ApiImport.php
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'includes/api/ApiImport.php')
-rw-r--r--includes/api/ApiImport.php38
1 files changed, 28 insertions, 10 deletions
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 @@
<?php
/**
- * API for MediaWiki 1.8+
+ *
*
* Created on Feb 4, 2009
*
- * Copyright © 2009 Roan Kattouw <Firstname>.<Lastname>@home.nl
+ * Copyright © 2009 Roan Kattouw <Firstname>.<Lastname>@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();