Change 1.26 to 1.27, mostly in doc comments
[lhc/web/wiklou.git] / includes / api / ApiImport.php
index 735cc7f..f0ca6fe 100644 (file)
@@ -92,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;
        }
@@ -107,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,