From 6f13020e330bbe8dd09220fc931d550291ff2ec8 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 27 Mar 2011 01:14:57 +0000 Subject: [PATCH] * (bug 28263) cannot import xml with the api, when have not "import" user right, but "importupload" Normalised api user right checking to that of SpecialImport, by moving permission checks into specified code paths Some documentation and explicit variables added while inspecting other code --- RELEASE-NOTES | 2 ++ includes/api/ApiImport.php | 7 ++++--- includes/specials/SpecialImport.php | 12 +++++++++++- includes/specials/SpecialUpload.php | 2 ++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 423b023dd6..200e991c8b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -290,6 +290,8 @@ PHP if you have not done so prior to upgrading MediaWiki. * API upload errors may now return the parameter that needs to be changed and a sessionkey to fix the error. * (bug 28249) allow dupes in meta=allmessages&amargs +* (bug 28263) cannot import xml with the api, when have not "import" user + right, but "importupload" === Languages updated in 1.18 === diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index f2c9bdeeeb..c497b9c933 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -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( array( 'cantimport' ) ); + } if ( !isset( $params['interwikipage'] ) ) { $this->dieUsageMsg( array( 'missingparam', 'interwikipage' ) ); } diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 7bb7950ef7..431f1a091c 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -37,6 +37,7 @@ class SpecialImport extends SpecialPage { private $logcomment= false; private $history = true; private $includeTemplates = false; + private $pageLinkDepth; /** * Constructor @@ -144,8 +145,9 @@ class SpecialImport extends SpecialPage { private function showForm() { global $wgUser, $wgOut, $wgImportSources, $wgExportMaxLinkDepth; - if( !$wgUser->isAllowedAny( 'import', 'importupload' ) ) + if( !$wgUser->isAllowedAny( 'import', 'importupload' ) ) { return $wgOut->permissionRequired( 'import' ); + } $action = $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) ); @@ -312,6 +314,14 @@ class ImportReporter { } } + /** + * @param Title $title + * @param Title $origTitle + * @param int $revisionCount + * @param $successCount + * @param $pageInfo + * @return void + */ function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) { global $wgOut, $wgUser, $wgLang, $wgContLang; diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index b17615c3f2..5aaa0f14e2 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -79,6 +79,8 @@ class SpecialUpload extends SpecialPage { public $uploadFormTextTop; public $uploadFormTextAfterSummary; + public $mWatchthis; + /** * Initialize instance variables from request and create an Upload handler * -- 2.20.1