Merge "Allow maintenance/cdb.php to look up keys with spaces in them."
[lhc/web/wiklou.git] / includes / filebackend / SwiftFileBackend.php
index e72d026..72a877d 100644 (file)
@@ -140,7 +140,7 @@ class SwiftFileBackend extends FileBackendStore {
                                $this->srvCache = ObjectCache::getLocalClusterInstance();
                        } else {
                                // Look for APC, XCache, WinCache, ect...
-                               $this->srvCache = ObjectCache::newAccelerator( CACHE_NONE );
+                               $this->srvCache = ObjectCache::getLocalServerInstance( CACHE_NONE );
                        }
                } else {
                        $this->srvCache = new EmptyBagOStuff();
@@ -262,7 +262,9 @@ class SwiftFileBackend extends FileBackendStore {
                }
 
                $sha1Hash = wfBaseConvert( sha1( $params['content'] ), 16, 36, 31 );
-               $contentType = $this->getContentType( $params['dst'], $params['content'], null );
+               $contentType = isset( $params['headers']['content-type'] )
+                       ? $params['headers']['content-type']
+                       : $this->getContentType( $params['dst'], $params['content'], null );
 
                $reqs = array( array(
                        'method' => 'PUT',
@@ -318,7 +320,9 @@ class SwiftFileBackend extends FileBackendStore {
                        return $status;
                }
                $sha1Hash = wfBaseConvert( $sha1Hash, 16, 36, 31 );
-               $contentType = $this->getContentType( $params['dst'], null, $params['src'] );
+               $contentType = isset( $params['headers']['content-type'] )
+                       ? $params['headers']['content-type']
+                       : $this->getContentType( $params['dst'], null, $params['src'] );
 
                $handle = fopen( $params['src'], 'rb' );
                if ( $handle === false ) { // source doesn't exist?
@@ -857,7 +861,7 @@ class SwiftFileBackend extends FileBackendStore {
                if ( !empty( $params['topOnly'] ) ) {
                        $status = $this->objectListing( $fullCont, 'names', $limit, $after, $prefix, '/' );
                        if ( !$status->isOk() ) {
-                               return $dirs; // error
+                               throw new FileBackendError( "Iterator page I/O error: {$status->getMessage()}" );
                        }
                        $objects = $status->value;
                        foreach ( $objects as $object ) { // files and directories
@@ -876,7 +880,7 @@ class SwiftFileBackend extends FileBackendStore {
                        $status = $this->objectListing( $fullCont, 'names', $limit, $after, $prefix );
 
                        if ( !$status->isOk() ) {
-                               return $dirs; // error
+                               throw new FileBackendError( "Iterator page I/O error: {$status->getMessage()}" );
                        }
 
                        $objects = $status->value;
@@ -952,7 +956,7 @@ class SwiftFileBackend extends FileBackendStore {
 
                // Reformat this list into a list of (name, stat array or null) entries
                if ( !$status->isOk() ) {
-                       return $files; // error
+                       throw new FileBackendError( "Iterator page I/O error: {$status->getMessage()}" );
                }
 
                $objects = $status->value;