X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilebackend%2FFileBackendGroup.php;h=1b88db7ec0b008903ec2aeb71987eac7f4df977f;hb=062a6fecdadd2bdbd6be303702e0e96c98dfda81;hp=491424bf611eebeafb7d135e48d89b5b78b20c66;hpb=49109173b4ad5fafb24688457e35b3c71d330346;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filebackend/FileBackendGroup.php b/includes/filebackend/FileBackendGroup.php index 491424bf61..1b88db7ec0 100644 --- a/includes/filebackend/FileBackendGroup.php +++ b/includes/filebackend/FileBackendGroup.php @@ -113,18 +113,18 @@ class FileBackendGroup { * Register an array of file backend configurations * * @param array $configs - * @throws MWException + * @throws FileBackendException */ protected function register( array $configs ) { foreach ( $configs as $config ) { if ( !isset( $config['name'] ) ) { - throw new MWException( "Cannot register a backend with no name." ); + throw new FileBackendException( "Cannot register a backend with no name." ); } $name = $config['name']; if ( isset( $this->backends[$name] ) ) { - throw new MWException( "Backend with name `{$name}` already registered." ); + throw new FileBackendException( "Backend with name `{$name}` already registered." ); } elseif ( !isset( $config['class'] ) ) { - throw new MWException( "Cannot register backend `{$name}` with no class." ); + throw new FileBackendException( "Backend with name `{$name}` has no class." ); } $class = $config['class']; @@ -142,16 +142,24 @@ class FileBackendGroup { * * @param string $name * @return FileBackend - * @throws MWException + * @throws FileBackendException */ public function get( $name ) { if ( !isset( $this->backends[$name] ) ) { - throw new MWException( "No backend defined with the name `$name`." ); + throw new FileBackendException( "No backend defined with the name `$name`." ); } // Lazy-load the actual backend instance if ( !isset( $this->backends[$name]['instance'] ) ) { $class = $this->backends[$name]['class']; $config = $this->backends[$name]['config']; + $config['wikiId'] = isset( $config['wikiId'] ) + ? $config['wikiId'] + : wfWikiID(); // e.g. "my_wiki-en_" + $config['lockManager'] = + LockManagerGroup::singleton( $config['wikiId'] )->get( $config['lockManager'] ); + $config['fileJournal'] = isset( $config['fileJournal'] ) + ? FileJournal::factory( $config['fileJournal'], $name ) + : FileJournal::factory( array( 'class' => 'NullFileJournal' ), $name ); $this->backends[$name]['instance'] = new $class( $config ); } @@ -163,11 +171,11 @@ class FileBackendGroup { * * @param string $name * @return array - * @throws MWException + * @throws FileBackendException */ public function config( $name ) { if ( !isset( $this->backends[$name] ) ) { - throw new MWException( "No backend defined with the name `$name`." ); + throw new FileBackendException( "No backend defined with the name `$name`." ); } $class = $this->backends[$name]['class'];