-
- $fields = array(
- 'img_name' => $filename,
- 'img_size' => $size,
- 'img_width' => $info['width'],
- 'img_height' => $info['height'],
- 'img_metadata' => '', // filled in on-demand
- 'img_bits' => $info['bits'],
- 'img_media_type' => $info['media'],
- 'img_major_mime' => $info['major'],
- 'img_minor_mime' => $info['minor'],
- 'img_description' => '(recovered file, missing upload log entry)',
- 'img_user' => 0,
- 'img_user_text' => 'Conversion script',
- 'img_timestamp' => $timestamp );
- if( !$this->dryrun ) {
- $this->dbw->insert( 'image', $fields, $fname );
+ if ( !$this->dryrun ) {
+ $file = wfLocalFile( $filename );
+ if ( !$file->recordUpload( '', '(recovered file, missing upload log entry)', '', '', '',
+ false, $timestamp ) )
+ {
+ $this->output( "Error uploading file $fullpath\n" );
+ return;
+ }