fix some spacing
[lhc/web/wiklou.git] / includes / filebackend / SwiftFileBackend.php
index 02c0c9a..4298221 100644 (file)
@@ -148,7 +148,7 @@ class SwiftFileBackend extends FileBackendStore {
                $this->connContainerCache = new ProcessCacheLRU( 300 );
                // Cache auth token information to avoid RTTs
                if ( !empty( $config['cacheAuthInfo'] ) ) {
-                       if ( php_sapi_name() === 'cli' ) {
+                       if ( PHP_SAPI === 'cli' ) {
                                $this->srvCache = wfGetMainCache(); // preferrably memcached
                        } else {
                                try { // look for APC, XCache, WinCache, ect...
@@ -201,7 +201,7 @@ class SwiftFileBackend extends FileBackendStore {
                $res = '';
                foreach ( explode( ';', $disposition ) as $part ) {
                        $part = trim( $part );
-                       $new  = ( $res === '' ) ? $part : "{$res};{$part}";
+                       $new = ( $res === '' ) ? $part : "{$res};{$part}";
                        if ( strlen( $new ) <= 255 ) {
                                $res = $new;
                        } else {
@@ -315,7 +315,9 @@ class SwiftFileBackend extends FileBackendStore {
                }
 
                // (b) Get a SHA-1 hash of the object
+               wfSuppressWarnings();
                $sha1Hash = sha1_file( $params['src'] );
+               wfRestoreWarnings();
                if ( $sha1Hash === false ) { // source doesn't exist?
                        $status->fatal( 'backend-fail-copy', $params['src'], $params['dst'] );
                        return $status;
@@ -988,7 +990,7 @@ class SwiftFileBackend extends FileBackendStore {
                                $objects = $container->list_objects( $limit, $after, $prefix );
                                foreach ( $objects as $object ) { // files
                                        $objectDir = $this->getParentDir( $object ); // directory of object
-                                       if ( $objectDir !== false ) { // file has a parent dir
+                                       if ( $objectDir !== false && $objectDir !== $dir ) {
                                                // Swift stores paths in UTF-8, using binary sorting.
                                                // See function "create_container_table" in common/db.py.
                                                // If a directory is not "greater" than the last one,