$sha1Hash = sha1_file( $params['src'] );
wfRestoreWarnings();
if ( $sha1Hash === false ) { // source doesn't exist?
- $status->fatal( 'backend-fail-copy', $params['src'], $params['dst'] );
+ $status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
return $status;
}
$handle = fopen( $params['src'], 'rb+' );
if ( $handle === false ) { // source doesn't exist?
- $status->fatal( 'backend-fail-copy', $params['src'], $params['dst'] );
+ $status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
return $status;
}
$reqs = $this->http->runMulti( $reqs );
foreach ( $reqs as $path => $op ) {
list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $op['response'];
- if ( $rcode >= 200 && $rcode <= 299 ) {
+ fclose( $op['stream'] ); // close open handle
+ if ( $rcode >= 200 && $rcode <= 299
+ // double check that the disk is not full/broken
+ && $tmpFile->getSize() == $rhdrs['content-length']
+ ) {
// good
} elseif ( $rcode === 404 ) {
$tmpFiles[$path] = false;
$this->onError( null, __METHOD__,
array( 'src' => $path ) + $ep, $rerr, $rcode, $rdesc );
}
- fclose( $op['stream'] ); // close open handle
}
}