Inserted test whether the resource 'uploadsource' is already registered.
authorAlexander Lehmann <alexander.lehmann@student.hpi.uni-potsdam.de>
Tue, 20 May 2014 12:26:33 +0000 (14:26 +0200)
committerAklapper <aklapper@wikimedia.org>
Tue, 20 May 2014 13:12:02 +0000 (13:12 +0000)
Bug: 65530

Change-Id: I1b82d6dc6a37792d4e7b7d01316802ea4d38a88b

includes/Import.php

index 743037c..4940c19 100644 (file)
@@ -45,7 +45,9 @@ class WikiImporter {
        function __construct( $source ) {
                $this->reader = new XMLReader();
 
-               stream_wrapper_register( 'uploadsource', 'UploadSourceAdapter' );
+               if ( !in_array(  'uploadsource', stream_get_wrappers() ) ) {
+                       stream_wrapper_register( 'uploadsource', 'UploadSourceAdapter' );
+               }
                $id = UploadSourceAdapter::registerSource( $source );
                if ( defined( 'LIBXML_PARSEHUGE' ) ) {
                        $this->reader->open( "uploadsource://$id", null, LIBXML_PARSEHUGE );