fix notice on construction without 'containerPaths'
authorAntoine Musso <hashar@users.mediawiki.org>
Wed, 8 Feb 2012 09:21:19 +0000 (09:21 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Wed, 8 Feb 2012 09:21:19 +0000 (09:21 +0000)
The comment block seems to indicate that containerPaths should only be used
for backwards-compatibility, which implies it is optional.

The following code generated a notice:

$fsBackend = new FSFileBackend( array(
'name'        => 'foo',
'lockManager' => 'fsLockManager',
'basePath'    => '/tmp/foo',
);

includes/filerepo/backend/FSFileBackend.php

index 68c69d6..881df56 100644 (file)
@@ -48,10 +48,13 @@ class FSFileBackend extends FileBackendStore {
                        $this->basePath = null; // none; containers must have explicit paths
                }
 
-               $this->containerPaths = (array)$config['containerPaths'];
-               foreach ( $this->containerPaths as &$path ) {
-                       rtrim( $path, '/' );  // remove trailing slash
+               if( isset( $config['containerPaths'] ) ) {
+                       $this->containerPaths = (array)$config['containerPaths'];
+                       foreach ( $this->containerPaths as &$path ) {
+                               rtrim( $path, '/' );  // remove trailing slash
+                       }
                }
+
                $this->fileMode = isset( $config['fileMode'] )
                        ? $config['fileMode']
                        : 0644;