private $history = true;
private $includeTemplates = false;
private $pageLinkDepth;
+ private $importSources;
/**
* Constructor
* @throws ReadOnlyError
*/
function execute( $par ) {
+ $this->useTransactionalTimeLimit();
+
$this->setHeaders();
$this->outputHeader();
$this->getOutput()->addModules( 'mediawiki.special.import' );
+ $this->importSources = $this->getConfig()->get( 'ImportSources' );
+ Hooks::run( 'ImportSources', array( &$this->importSources ) );
+
$user = $this->getUser();
if ( !$user->isAllowedAny( 'import', 'importupload' ) ) {
throw new PermissionsError( 'import' );
}
$this->interwiki = $this->fullInterwikiPrefix = $request->getVal( 'interwiki' );
// does this interwiki have subprojects?
- $importSources = $this->getConfig()->get( 'ImportSources' );
- $hasSubprojects = array_key_exists( $this->interwiki, $importSources );
- if ( !$hasSubprojects && !in_array( $this->interwiki, $importSources ) ) {
+ $hasSubprojects = array_key_exists( $this->interwiki, $this->importSources );
+ if ( !$hasSubprojects && !in_array( $this->interwiki, $this->importSources ) ) {
$source = Status::newFatal( "import-invalid-interwiki" );
} else {
if ( $hasSubprojects ) {
$this->subproject = $request->getVal( 'subproject' );
$this->fullInterwikiPrefix .= ':' . $request->getVal( 'subproject' );
}
- if ( $hasSubprojects && !in_array( $this->subproject, $importSources[$this->interwiki] ) ) {
+ if ( $hasSubprojects &&
+ !in_array( $this->subproject, $this->importSources[$this->interwiki] )
+ ) {
$source = Status::newFatal( "import-invalid-interwiki" );
} else {
$this->history = $request->getCheck( 'interwikiHistory' );
$user = $this->getUser();
$out = $this->getOutput();
$this->addHelpLink( '//meta.wikimedia.org/wiki/Special:MyLanguage/Help:Import', true );
- $importSources = $this->getConfig()->get( 'ImportSources' );
if ( $user->isAllowed( 'importupload' ) ) {
$mappingSelection = $this->getMappingFormPart( 'upload' );
Xml::closeElement( 'fieldset' )
);
} else {
- if ( empty( $importSources ) ) {
+ if ( empty( $this->importSources ) ) {
$out->addWikiMsg( 'importnosources' );
}
}
- if ( $user->isAllowed( 'import' ) && !empty( $importSources ) ) {
+ if ( $user->isAllowed( 'import' ) && !empty( $this->importSources ) ) {
# Show input field for import depth only if $wgExportMaxLinkDepth > 0
$importDepth = '';
if ( $this->getConfig()->get( 'ExportMaxLinkDepth' ) > 0 ) {
);
$needSubprojectField = false;
- foreach ( $importSources as $key => $value ) {
+ foreach ( $this->importSources as $key => $value ) {
if ( is_int( $key ) ) {
$key = $value;
} elseif ( $value !== $key ) {
);
$subprojectsToAdd = array();
- foreach ( $importSources as $key => $value ) {
+ foreach ( $this->importSources as $key => $value ) {
if ( is_array( $value ) ) {
$subprojectsToAdd = array_merge( $subprojectsToAdd, $value );
}