API Import: Die when namespace and rootpage is set
authorumherirrender <umherirrender_de.wp@web.de>
Thu, 14 May 2015 19:32:30 +0000 (21:32 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Thu, 14 May 2015 19:32:30 +0000 (21:32 +0200)
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
includes/api/i18n/en.json

index 40cf6e2..4154083 100644 (file)
@@ -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' ) ) {
index 3c53be1..bece0b2 100644 (file)
        "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 <kbd>$1rootpage</kbd> parameter.",
-       "apihelp-import-param-rootpage": "Import as subpage of this page. Ignored if the <kbd>$1namespace</kbd> parameter is provided.",
+       "apihelp-import-param-namespace": "Import to this namespace. Cannot be used together with <var>$1rootpage</var>.",
+       "apihelp-import-param-rootpage": "Import as subpage of this page. Cannot be used together with <var>$1namespace</var>.",
        "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.",