X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiImport.php;h=f0ca6fe4ad96cdf88dc0c90164d2631ba6dd6d9a;hb=b52502eec55050219e414b23a0be37c5a4d08c01;hp=41540836ef721e1894bfe203bee8c00801764ca5;hpb=8c087b9fd13d9302ec1be2176ef1ae344b3f8273;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index 41540836ef..f0ca6fe4ad 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -32,6 +32,8 @@ class ApiImport extends ApiBase { public function execute() { + $this->useTransactionalTimeLimit(); + $user = $this->getUser(); $params = $this->extractRequestParams(); @@ -90,6 +92,30 @@ class ApiImport extends ApiBase { $result->addValue( null, $this->getModuleName(), $resultData ); } + /** + * Returns a list of interwiki prefixes corresponding to each defined import + * source. + * + * @return array + * @since 1.27 + */ + public function getAllowedImportSources() { + $importSources = $this->getConfig()->get( 'ImportSources' ); + Hooks::run( 'ImportSources', array( &$importSources ) ); + + $result = array(); + foreach ( $importSources as $key => $value ) { + if ( is_int( $key ) ) { + $result[] = $value; + } else { + foreach ( $value as $subproject ) { + $result[] = "$key:$subproject"; + } + } + } + return $result; + } + public function mustBePosted() { return true; } @@ -105,7 +131,7 @@ class ApiImport extends ApiBase { ApiBase::PARAM_TYPE => 'upload', ), 'interwikisource' => array( - ApiBase::PARAM_TYPE => $this->getConfig()->get( 'ImportSources' ), + ApiBase::PARAM_TYPE => $this->getAllowedImportSources(), ), 'interwikipage' => null, 'fullhistory' => false,