Merge "[search] Fix method call on null value"
[lhc/web/wiklou.git] / includes / filebackend / SwiftFileBackend.php
index 408194f..83c1da1 100644 (file)
@@ -136,9 +136,10 @@ class SwiftFileBackend extends FileBackendStore {
                // Cache auth token information to avoid RTTs
                if ( !empty( $config['cacheAuthInfo'] ) ) {
                        if ( PHP_SAPI === 'cli' ) {
-                               $this->srvCache = wfGetMainCache(); // preferrably memcached
+                               // Preferrably memcached
+                               $this->srvCache = ObjectCache::getLocalClusterInstance();
                        } else {
-                               // look for APC, XCache, WinCache, ect...
+                               // Look for APC, XCache, WinCache, ect...
                                $this->srvCache = ObjectCache::newAccelerator( CACHE_NONE );
                        }
                } else {
@@ -261,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',
@@ -317,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?