Merge "Remove hphpc support and deprecate related functions"
[lhc/web/wiklou.git] / includes / filebackend / SwiftFileBackend.php
index aadad5c..1527cfe 100644 (file)
@@ -104,7 +104,7 @@ class SwiftFileBackend extends FileBackendStore {
         */
        public function __construct( array $config ) {
                parent::__construct( $config );
-               if ( !MWInit::classExists( 'CF_Constants' ) ) {
+               if ( !class_exists( 'CF_Constants' ) ) {
                        throw new MWException( 'SwiftCloudFiles extension not installed.' );
                }
                // Required settings
@@ -132,7 +132,7 @@ class SwiftFileBackend extends FileBackendStore {
                        : false;
                $this->swiftCDNExpiry = isset( $config['swiftCDNExpiry'] )
                        ? $config['swiftCDNExpiry']
-                       : 12*3600; // 12 hours is safe (tokens last 24 hours per http://docs.openstack.org)
+                       : 12 * 3600; // 12 hours is safe (tokens last 24 hours per http://docs.openstack.org)
                $this->swiftCDNPurgable = isset( $config['swiftCDNPurgable'] )
                        ? $config['swiftCDNPurgable']
                        : true;
@@ -807,8 +807,8 @@ class SwiftFileBackend extends FileBackendStore {
                        $stat = array(
                                // Convert dates like "Tue, 03 Jan 2012 22:01:04 GMT" to TS_MW
                                'mtime' => wfTimestamp( TS_MW, $srcObj->last_modified ),
-                               'size'  => (int)$srcObj->content_length,
-                               'sha1'  => $srcObj->getMetadataValue( 'Sha1base36' )
+                               'size' => (int)$srcObj->content_length,
+                               'sha1' => $srcObj->getMetadataValue( 'Sha1base36' )
                        );
                } catch ( NoSuchContainerException $e ) {
                } catch ( NoSuchObjectException $e ) {
@@ -1239,8 +1239,8 @@ class SwiftFileBackend extends FileBackendStore {
                                                str_replace( '/swift/v1', '', // S3 API is the rgw default
                                                        $sContObj->cfs_http->getStorageUrl() . $spath ),
                                                array(
-                                                       'Signature'      => $signature,
-                                                       'Expires'        => $expires,
+                                                       'Signature' => $signature,
+                                                       'Expires' => $expires,
                                                        'AWSAccessKeyId' => $this->rgwS3AccessKey )
                                        );
                                }
@@ -1316,7 +1316,7 @@ class SwiftFileBackend extends FileBackendStore {
         *                           matches the expression and the request is not for a listing.
         *                           Setting this to '*' effectively makes a container public.
         *   -".rlistings:<regex>" : Grants access if the request is from a referrer host that
-        *                           matches the expression and the request for a listing.
+        *                           matches the expression and the request is for a listing.
         *
         * $writeGrps is a list of the possible criteria for a request to have
         * access to write to a container. Each item is of the following format:
@@ -1397,12 +1397,12 @@ class SwiftFileBackend extends FileBackendStore {
                        if ( is_array( $creds ) ) { // cache hit
                                $this->auth->load_cached_credentials(
                                        $creds['auth_token'], $creds['storage_url'], $creds['cdnm_url'] );
-                               $this->sessionStarted = time() - ceil( $this->authTTL/2 ); // skew for worst case
+                               $this->sessionStarted = time() - ceil( $this->authTTL / 2 ); // skew for worst case
                        } else { // cache miss
                                try {
                                        $this->auth->authenticate();
                                        $creds = $this->auth->export_credentials();
-                                       $this->srvCache->add( $cacheKey, $creds, ceil( $this->authTTL/2 ) ); // cache
+                                       $this->srvCache->add( $cacheKey, $creds, ceil( $this->authTTL / 2 ) ); // cache
                                        $this->sessionStarted = time();
                                } catch ( CloudFilesException $e ) {
                                        $this->connException = $e; // don't keep re-trying