Merge "API: Use message-per-value for apihelp-query+usercontribs-param-prop"
[lhc/web/wiklou.git] / includes / api / ApiImport.php
index 2e87d22..735cc7f 100644 (file)
 class ApiImport extends ApiBase {
 
        public function execute() {
+               $this->useTransactionalTimeLimit();
+
                $user = $this->getUser();
                $params = $this->extractRequestParams();
 
+               $this->requireMaxOneParameter( $params, 'namespace', 'rootpage' );
+
                $isUpload = false;
                if ( isset( $params['interwikisource'] ) ) {
                        if ( !$user->isAllowed( 'import' ) ) {
@@ -63,8 +67,7 @@ class ApiImport extends ApiBase {
                $importer = new WikiImporter( $source->value, $this->getConfig() );
                if ( isset( $params['namespace'] ) ) {
                        $importer->setTargetNamespace( $params['namespace'] );
-               }
-               if ( isset( $params['rootpage'] ) ) {
+               } elseif ( isset( $params['rootpage'] ) ) {
                        $statusRootPage = $importer->setTargetRootPage( $params['rootpage'] );
                        if ( !$statusRootPage->isGood() ) {
                                $this->dieStatus( $statusRootPage );