From 05c726307946353ce0f6a651ffee164b3a699b45 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Thu, 14 May 2015 21:32:30 +0200 Subject: [PATCH] API Import: Die when namespace and rootpage is set With I11521260a88a7f4a95fbdb71ac50bcf7b4fe5cd1 the rootpage parameter gets ignored when namespace parameter is set. This can break the behaviour for the client. Just break the client by returning an error instead of silent ignoring a parameter. Change-Id: Ie1c7447b5d59ff4d3466b504d5d1afc0d296841a --- includes/api/ApiImport.php | 2 ++ includes/api/i18n/en.json | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index 40cf6e29ce..41540836ef 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -35,6 +35,8 @@ class ApiImport extends ApiBase { $user = $this->getUser(); $params = $this->extractRequestParams(); + $this->requireMaxOneParameter( $params, 'namespace', 'rootpage' ); + $isUpload = false; if ( isset( $params['interwikisource'] ) ) { if ( !$user->isAllowed( 'import' ) ) { diff --git a/includes/api/i18n/en.json b/includes/api/i18n/en.json index 3c53be155d..bece0b2818 100644 --- a/includes/api/i18n/en.json +++ b/includes/api/i18n/en.json @@ -196,8 +196,8 @@ "apihelp-import-param-interwikipage": "For interwiki imports: page to import.", "apihelp-import-param-fullhistory": "For interwiki imports: import the full history, not just the current version.", "apihelp-import-param-templates": "For interwiki imports: import all included templates as well.", - "apihelp-import-param-namespace": "Import to this namespace. Overrides the $1rootpage parameter.", - "apihelp-import-param-rootpage": "Import as subpage of this page. Ignored if the $1namespace parameter is provided.", + "apihelp-import-param-namespace": "Import to this namespace. Cannot be used together with $1rootpage.", + "apihelp-import-param-rootpage": "Import as subpage of this page. Cannot be used together with $1namespace.", "apihelp-import-example-import": "Import [[meta:Help:Parserfunctions]] to namespace 100 with full history.", "apihelp-login-description": "Log in and get authentication cookies.\n\nIn the event of a successful log-in, the needed cookies will be included in the HTTP response headers. In the event of a failed log-in, further attempts may be throttled to limit automated password guessing attacks.", -- 2.20.1