X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiImport.php;h=8574dceb4f5b77316e40320d41d95c0e8cd62e22;hb=58cb1f824ac75c3b58ba19d1e88c1b38f9dc1fab;hp=a6aae4bb1c3dac6aa9311af96dd89993fb20ab28;hpb=f2244f61f447c3a6556169e3d177e64d2e496a40;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index a6aae4bb1c..8574dceb4f 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -45,7 +45,7 @@ class ApiImport extends ApiBase { $this->dieUsageMsg( 'cantimport' ); } if ( !isset( $params['interwikipage'] ) ) { - $this->dieUsageMsg( array( 'missingparam', 'interwikipage' ) ); + $this->dieUsageMsg( [ 'missingparam', 'interwikipage' ] ); } $source = ImportStreamSource::newFromInterwiki( $params['interwikisource'], @@ -83,7 +83,7 @@ class ApiImport extends ApiBase { try { $importer->doImport(); } catch ( Exception $e ) { - $this->dieUsageMsg( array( 'import-unknownerror', $e->getMessage() ) ); + $this->dieUsageMsg( [ 'import-unknownerror', $e->getMessage() ] ); } $resultData = $reporter->getData(); @@ -97,13 +97,13 @@ class ApiImport extends ApiBase { * source. * * @return array - * @since 1.26 + * @since 1.27 */ public function getAllowedImportSources() { $importSources = $this->getConfig()->get( 'ImportSources' ); - Hooks::run( 'ImportSources', array( &$importSources ) ); + Hooks::run( 'ImportSources', [ &$importSources ] ); - $result = array(); + $result = []; foreach ( $importSources as $key => $value ) { if ( is_int( $key ) ) { $result[] = $value; @@ -125,22 +125,22 @@ class ApiImport extends ApiBase { } public function getAllowedParams() { - return array( + return [ 'summary' => null, - 'xml' => array( + 'xml' => [ ApiBase::PARAM_TYPE => 'upload', - ), - 'interwikisource' => array( + ], + 'interwikisource' => [ ApiBase::PARAM_TYPE => $this->getAllowedImportSources(), - ), + ], 'interwikipage' => null, 'fullhistory' => false, 'templates' => false, - 'namespace' => array( + 'namespace' => [ ApiBase::PARAM_TYPE => 'namespace' - ), + ], 'rootpage' => null, - ); + ]; } public function needsToken() { @@ -148,11 +148,11 @@ class ApiImport extends ApiBase { } protected function getExamplesMessages() { - return array( + return [ 'action=import&interwikisource=meta&interwikipage=Help:ParserFunctions&' . 'namespace=100&fullhistory=&token=123ABC' => 'apihelp-import-example-import', - ); + ]; } public function getHelpUrls() { @@ -165,7 +165,7 @@ class ApiImport extends ApiBase { * @ingroup API */ class ApiImportReporter extends ImportReporter { - private $mResultArr = array(); + private $mResultArr = []; /** * @param Title $title @@ -177,7 +177,7 @@ class ApiImportReporter extends ImportReporter { */ function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) { // Add a result entry - $r = array(); + $r = []; if ( $title === null ) { # Invalid or non-importable title