X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Ffilebackend%2FSwiftFileBackend.php;h=93d8d07a98bb8d3e51dfe35e22f8120388465f8e;hb=6da98ee84b844c9fba0d6c7fa76d8fc50bf2abbc;hp=e72d02620524e638b5c6bceedb5ca4d9c3807f68;hpb=9140248018538a05560edf6ee32fcc4268d9d597;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index e72d026205..93d8d07a98 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -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(); @@ -261,8 +261,10 @@ class SwiftFileBackend extends FileBackendStore { return $status; } - $sha1Hash = wfBaseConvert( sha1( $params['content'] ), 16, 36, 31 ); - $contentType = $this->getContentType( $params['dst'], $params['content'], null ); + $sha1Hash = Wikimedia\base_convert( sha1( $params['content'] ), 16, 36, 31 ); + $contentType = isset( $params['headers']['content-type'] ) + ? $params['headers']['content-type'] + : $this->getContentType( $params['dst'], $params['content'], null ); $reqs = array( array( 'method' => 'PUT', @@ -317,8 +319,10 @@ class SwiftFileBackend extends FileBackendStore { return $status; } - $sha1Hash = wfBaseConvert( $sha1Hash, 16, 36, 31 ); - $contentType = $this->getContentType( $params['dst'], null, $params['src'] ); + $sha1Hash = Wikimedia\base_convert( $sha1Hash, 16, 36, 31 ); + $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;