fix some spacing
[lhc/web/wiklou.git] / includes / filebackend / FileBackendStore.php
index a7df19d..35384c7 100644 (file)
@@ -57,8 +57,8 @@ abstract class FileBackendStore extends FileBackend {
         */
        public function __construct( array $config ) {
                parent::__construct( $config );
-               $this->memCache       = new EmptyBagOStuff(); // disabled by default
-               $this->cheapCache     = new ProcessCacheLRU( 300 );
+               $this->memCache = new EmptyBagOStuff(); // disabled by default
+               $this->cheapCache = new ProcessCacheLRU( 300 );
                $this->expensiveCache = new ProcessCacheLRU( 5 );
        }
 
@@ -366,12 +366,8 @@ abstract class FileBackendStore extends FileBackend {
         */
        protected function doConcatenate( array $params ) {
                $status = Status::newGood();
-
                $tmpPath = $params['dst']; // convenience
                unset( $params['latest'] ); // sanity
-               $callback = isset( $params['callback'] )
-                       ? $params['callback']
-                       : function( Status $status, $segment ) {};
 
                // Check that the specified temp file is valid...
                wfSuppressWarnings();
@@ -379,7 +375,6 @@ abstract class FileBackendStore extends FileBackend {
                wfRestoreWarnings();
                if ( !$ok ) { // not present or not empty
                        $status->fatal( 'backend-fail-opentemp', $tmpPath );
-                       $callback( $status, null ); // update progress
                        return $status;
                }
 
@@ -390,7 +385,6 @@ abstract class FileBackendStore extends FileBackend {
                                $fsFile = $this->getLocalReference( array( 'src' => $path ) );
                                if ( !$fsFile ) { // retry failed?
                                        $status->fatal( 'backend-fail-read', $path );
-                                       $callback( $status, null ); // update progress
                                        return $status;
                                }
                        }
@@ -401,20 +395,16 @@ abstract class FileBackendStore extends FileBackend {
                $tmpHandle = fopen( $tmpPath, 'ab' );
                if ( $tmpHandle === false ) {
                        $status->fatal( 'backend-fail-opentemp', $tmpPath );
-                       $callback( $status, null ); // update progress
                        return $status;
                }
 
-               $segment = 0; // segment number
                // Build up the temp file using the source chunks (in order)...
                foreach ( $fsFiles as $virtualSource => $fsFile ) {
-                       ++$segment; // first segment is "1"
                        // Get a handle to the local FS version
                        $sourceHandle = fopen( $fsFile->getPath(), 'rb' );
                        if ( $sourceHandle === false ) {
                                fclose( $tmpHandle );
                                $status->fatal( 'backend-fail-read', $virtualSource );
-                               $callback( $status, null ); // update progress
                                return $status;
                        }
                        // Append chunk to file (pass chunk size to avoid magic quotes)
@@ -422,20 +412,16 @@ abstract class FileBackendStore extends FileBackend {
                                fclose( $sourceHandle );
                                fclose( $tmpHandle );
                                $status->fatal( 'backend-fail-writetemp', $tmpPath );
-                               $callback( $status , null );
                                return $status;
                        }
                        fclose( $sourceHandle );
-                       $callback( $status, $segment ); // update progress (chunk success)
                }
                if ( !fclose( $tmpHandle ) ) {
                        $status->fatal( 'backend-fail-closetemp', $tmpPath );
-                       $callback( $status, null ); // update progress
                        return $status;
                }
 
                clearstatcache(); // temp file changed
-               $callback( $status, null ); // update progress (full success)
 
                return $status;
        }
@@ -781,10 +767,7 @@ abstract class FileBackendStore extends FileBackend {
                $hash = $this->doGetFileSha1Base36( $params );
                wfProfileOut( __METHOD__ . '-miss-' . $this->name );
                wfProfileOut( __METHOD__ . '-miss' );
-               if ( $hash ) { // don't cache negatives
-                       $this->cheapCache->set( $path, 'sha1',
-                               array( 'hash' => $hash, 'latest' => $latest ) );
-               }
+               $this->cheapCache->set( $path, 'sha1', array( 'hash' => $hash, 'latest' => $latest ) );
                wfProfileOut( __METHOD__ . '-' . $this->name );
                wfProfileOut( __METHOD__ );
                return $hash;