[FileBackend] Added duplicate backend check.
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 28 Jan 2013 06:36:28 +0000 (22:36 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 28 Jan 2013 06:36:28 +0000 (22:36 -0800)
* Not sure when this disappeared from before.

Change-Id: I69a8ce06b2f3bae0e65fb65b63440eb0a2e1128c

includes/filebackend/FileBackendGroup.php

index 8bbc96d..5327204 100644 (file)
@@ -122,7 +122,9 @@ class FileBackendGroup {
                                throw new MWException( "Cannot register a backend with no name." );
                        }
                        $name = $config['name'];
-                       if ( !isset( $config['class'] ) ) {
+                       if ( isset( $this->backends[$name] ) ) {
+                               throw new MWException( "Backend with name `{$name}` already registered." );
+                       } elseif ( !isset( $config['class'] ) ) {
                                throw new MWException( "Cannot register backend `{$name}` with no class." );
                        }
                        $class = $config['class'];