$this->swiftUser = $config['swiftUser'];
$this->swiftKey = $config['swiftKey'];
// Optional settings
- $this->authTTL = isset( $config['swiftAuthTTL'] )
- ? $config['swiftAuthTTL']
- : 15 * 60; // some sane number
- $this->swiftTempUrlKey = isset( $config['swiftTempUrlKey'] )
- ? $config['swiftTempUrlKey']
- : '';
- $this->swiftStorageUrl = isset( $config['swiftStorageUrl'] )
- ? $config['swiftStorageUrl']
- : null;
- $this->shardViaHashLevels = isset( $config['shardViaHashLevels'] )
- ? $config['shardViaHashLevels']
- : '';
- $this->rgwS3AccessKey = isset( $config['rgwS3AccessKey'] )
- ? $config['rgwS3AccessKey']
- : '';
- $this->rgwS3SecretKey = isset( $config['rgwS3SecretKey'] )
- ? $config['rgwS3SecretKey']
- : '';
+ $this->authTTL = $config['swiftAuthTTL'] ?? 15 * 60; // some sane number
+ $this->swiftTempUrlKey = $config['swiftTempUrlKey'] ?? '';
+ $this->swiftStorageUrl = $config['swiftStorageUrl'] ?? null;
+ $this->shardViaHashLevels = $config['shardViaHashLevels'] ?? '';
+ $this->rgwS3AccessKey = $config['rgwS3AccessKey'] ?? '';
+ $this->rgwS3SecretKey = $config['rgwS3SecretKey'] ?? '';
// HTTP helper client
$this->http = new MultiHttpClient( [] );
// Cache container information to mask latency
} else {
$this->srvCache = new EmptyBagOStuff();
}
- $this->readUsers = isset( $config['readUsers'] )
- ? $config['readUsers']
- : [];
- $this->writeUsers = isset( $config['writeUsers'] )
- ? $config['writeUsers']
- : [];
- $this->secureReadUsers = isset( $config['secureReadUsers'] )
- ? $config['secureReadUsers']
- : [];
- $this->secureWriteUsers = isset( $config['secureWriteUsers'] )
- ? $config['secureWriteUsers']
- : [];
+ $this->readUsers = $config['readUsers'] ?? [];
+ $this->writeUsers = $config['writeUsers'] ?? [];
+ $this->secureReadUsers = $config['secureReadUsers'] ?? [];
+ $this->secureWriteUsers = $config['secureWriteUsers'] ?? [];
}
public function getFeatures() {
}
$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 );
+ $contentType = $params['headers']['content-type']
+ ?? $this->getContentType( $params['dst'], $params['content'], null );
$reqs = [ [
'method' => 'PUT',
return $status;
}
$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'] );
+ $contentType = $params['headers']['content-type']
+ ?? $this->getContentType( $params['dst'], null, $params['src'] );
$handle = fopen( $params['src'], 'rb' );
if ( $handle === false ) { // source doesn't exist?
return null;
}
- $ttl = isset( $params['ttl'] ) ? $params['ttl'] : 86400;
+ $ttl = $params['ttl'] ?? 86400;
$expires = time() + $ttl;
if ( $this->swiftTempUrlKey != '' ) {
foreach ( $reqs as $stage => &$req ) {
list( $container, $relPath ) = $req['url'];
$req['url'] = $this->storageUrl( $auth, $container, $relPath );
- $req['headers'] = isset( $req['headers'] ) ? $req['headers'] : [];
+ $req['headers'] = $req['headers'] ?? [];
$req['headers'] = $this->authTokenHeaders( $auth ) + $req['headers'];
$httpReqsByStage[$stage][$index] = $req;
}
'mtime' => $this->convertSwiftDate( $rhdrs['last-modified'], TS_MW ),
// Empty objects actually return no content-length header in Ceph
'size' => isset( $rhdrs['content-length'] ) ? (int)$rhdrs['content-length'] : 0,
- 'sha1' => isset( $metadata['sha1base36'] ) ? $metadata['sha1base36'] : null,
+ 'sha1' => $metadata['sha1base36'] ?? null,
// Note: manifiest ETags are not an MD5 of the file
'md5' => ctype_xdigit( $rhdrs['etag'] ) ? $rhdrs['etag'] : null,
'xattr' => [ 'metadata' => $metadata, 'headers' => $headers ]
if ( $code == 401 ) { // possibly a stale token
$this->srvCache->delete( $this->getCredsCacheKey( $this->swiftUser ) );
}
- $msg = "HTTP {code} ({desc}) in '{func}' (given '{params}')";
+ $msg = "HTTP {code} ({desc}) in '{func}' (given '{req_params}')";
$msgParams = [
'code' => $code,
'desc' => $desc,