From: Aaron Schulz Date: Thu, 1 May 2014 19:34:42 +0000 (-0700) Subject: Made partial file download errors in Swift more useful X-Git-Tag: 1.31.0-rc.0~15923 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22messagerie%22%29%20.%20%22?a=commitdiff_plain;h=45c1d73bdb01776aff6bd09f0ccdaffe2542d224;p=lhc%2Fweb%2Fwiklou.git Made partial file download errors in Swift more useful Change-Id: I97a5cd1ed38508468122e33968b88adf2570a9a3 --- diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index cae407919e..2f4be9ed4a 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -1064,11 +1064,14 @@ class SwiftFileBackend extends FileBackendStore { foreach ( $reqs as $path => $op ) { list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $op['response']; fclose( $op['stream'] ); // close open handle - if ( $rcode >= 200 && $rcode <= 299 - // double check that the disk is not full/broken - && $tmpFiles[$path]->getSize() == $rhdrs['content-length'] - ) { - // good + if ( $rcode >= 200 && $rcode <= 299 ) { + // Double check that the disk is not full/broken + if ( $tmpFiles[$path]->getSize() != $rhdrs['content-length'] ) { + $tmpFiles[$path] = null; + $rerr = "Got {$tmpFiles[$path]->getSize()}/{$rhdrs['content-length']} bytes"; + $this->onError( null, __METHOD__, + array( 'src' => $path ) + $ep, $rerr, $rcode, $rdesc ); + } } elseif ( $rcode === 404 ) { $tmpFiles[$path] = false; } else {