Merge "Made TransactionProfiler handle nested transactions to the same server/DB"
[lhc/web/wiklou.git] / includes / filebackend / SwiftFileBackend.php
index 174f9f3..2f4be9e 100644 (file)
@@ -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 {
@@ -1394,7 +1397,7 @@ class SwiftFileBackend extends FileBackendStore {
         *
         * @param string $fullCont
         * @param string $type ('info' for a list of object detail maps, 'names' for names only)
-        * @param integer $limit
+        * @param int $limit
         * @param string|null $after
         * @param string|null $prefix
         * @param string|null $delim
@@ -1641,7 +1644,7 @@ class SwiftFileBackend extends FileBackendStore {
         * @param string $func
         * @param array $params
         * @param string $err Error string
-        * @param integer $code HTTP status
+        * @param int $code HTTP status
         * @param string $desc HTTP status description
         */
        public function onError( $status, $func, array $params, $err = '', $code = 0, $desc = '' ) {