From: Sam Reed Date: Sun, 27 Mar 2011 01:14:57 +0000 (+0000) Subject: * (bug 28263) cannot import xml with the api, when have not "import" user right,... X-Git-Tag: 1.31.0-rc.0~31169 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=6f13020e330bbe8dd09220fc931d550291ff2ec8;p=lhc%2Fweb%2Fwiklou.git * (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 --- 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 *