X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FImport.php;h=533d53819238714f5c600aebf9a3d2afbe5277ab;hb=b2bfcc788af991825d6d589c29d5376bc36469ef;hp=fd33e037bbd9b9b1115d0f54ce1b46a66af2ac3f;hpb=5be509b0c16ec1af1a3014f60b57a0f796079d86;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Import.php b/includes/Import.php index fd33e037bb..533d538192 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -311,7 +311,6 @@ class WikiRevision { $file = wfLocalFile( $this->getTitle() ); if( !$file ) { - var_dump( $file ); wfDebug( "IMPORT: Bad file. :(\n" ); return false; } @@ -415,27 +414,27 @@ class ImportStreamSource { static function newFromFile( $filename ) { $file = @fopen( $filename, 'rt' ); if( !$file ) { - return new WikiErrorMsg( "importcantopen" ); + return Status::newFatal( "importcantopen" ); } - return new ImportStreamSource( $file ); + return Status::newGood( new ImportStreamSource( $file ) ); } static function newFromUpload( $fieldname = "xmlimport" ) { $upload =& $_FILES[$fieldname]; if( !isset( $upload ) || !$upload['name'] ) { - return new WikiErrorMsg( 'importnofile' ); + return Status::newFatal( 'importnofile' ); } if( !empty( $upload['error'] ) ) { switch($upload['error']){ case 1: # The uploaded file exceeds the upload_max_filesize directive in php.ini. - return new WikiErrorMsg( 'importuploaderrorsize' ); + return Status::newFatal( 'importuploaderrorsize' ); case 2: # The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form. - return new WikiErrorMsg( 'importuploaderrorsize' ); + return Status::newFatal( 'importuploaderrorsize' ); case 3: # The uploaded file was only partially uploaded - return new WikiErrorMsg( 'importuploaderrorpartial' ); - case 6: #Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. - return new WikiErrorMsg( 'importuploaderrortemp' ); + return Status::newFatal( 'importuploaderrorpartial' ); + case 6: #Missing a temporary folder. + return Status::newFatal( 'importuploaderrortemp' ); # case else: # Currently impossible } @@ -444,7 +443,7 @@ class ImportStreamSource { if( is_uploaded_file( $fname ) ) { return ImportStreamSource::newFromFile( $fname ); } else { - return new WikiErrorMsg( 'importnofile' ); + return Status::newFatal( 'importnofile' ); } } @@ -460,19 +459,19 @@ class ImportStreamSource { fwrite( $file, $data ); fflush( $file ); fseek( $file, 0 ); - return new ImportStreamSource( $file ); + return Status::newGood( new ImportStreamSource( $file ) ); } else { - return new WikiErrorMsg( 'importcantopen' ); + return Status::newFatal( 'importcantopen' ); } } public static function newFromInterwiki( $interwiki, $page, $history = false, $templates = false, $pageLinkDepth = 0 ) { if( $page == '' ) { - return new WikiErrorMsg( 'import-noarticle' ); + return Status::newFatal( 'import-noarticle' ); } $link = Title::newFromText( "$interwiki:Special:Export/$page" ); if( is_null( $link ) || $link->getInterwiki() == '' ) { - return new WikiErrorMsg( 'importbadinterwiki' ); + return Status::newFatal( 'importbadinterwiki' ); } else { $params = array(); if ( $history ) $params['history'] = 1;