r110924 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110923‎ | r110924 | r110925 >
Date:09:21, 8 February 2012
Author:hashar
Status:ok
Tags:
Comment:
fix notice on construction without 'containerPaths'

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',
);
Modified paths:
  • /trunk/phase3/includes/filerepo/backend/FSFileBackend.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/backend/FSFileBackend.php
@@ -48,10 +48,13 @@
4949 $this->basePath = null; // none; containers must have explicit paths
5050 }
5151
52 - $this->containerPaths = (array)$config['containerPaths'];
53 - foreach ( $this->containerPaths as &$path ) {
54 - rtrim( $path, '/' ); // remove trailing slash
 52+ if( isset( $config['containerPaths'] ) ) {
 53+ $this->containerPaths = (array)$config['containerPaths'];
 54+ foreach ( $this->containerPaths as &$path ) {
 55+ rtrim( $path, '/' ); // remove trailing slash
 56+ }
5557 }
 58+
5659 $this->fileMode = isset( $config['fileMode'] )
5760 ? $config['fileMode']
5861 : 0644;

Status & tagging log