- $config['class'] = $class;
- $config += [ // set defaults
- // @FIXME: this does not include the domain for b/c but it ideally should
- 'wikiId' => wfWikiID(), // e.g. "my_wiki-en_"
- 'mimeCallback' => [ $this, 'guessMimeInternal' ],
- 'obResetFunc' => 'wfResetOutputBuffers',
- 'streamMimeFunc' => [ StreamFile::class, 'contentTypeFromPath' ],
- 'tmpDirectory' => wfTempDir(),
- 'statusWrapper' => [ Status::class, 'wrap' ],
- 'wanCache' => MediaWikiServices::getInstance()->getMainWANObjectCache(),
- 'srvCache' => ObjectCache::getLocalServerInstance( 'hash' ),
- 'logger' => LoggerFactory::getInstance( 'FileOperation' ),
- 'profiler' => function ( $section ) {
- return Profiler::instance()->scopedProfileIn( $section );
- }
- ];
- $config['lockManager'] =
- LockManagerGroup::singleton( $config['wikiId'] )->get( $config['lockManager'] );
- $config['fileJournal'] = isset( $config['fileJournal'] )
- ? FileJournal::factory( $config['fileJournal'], $name )
- : FileJournal::factory( [ 'class' => NullFileJournal::class ], $name );
-
- return $config;
+ $services = MediaWikiServices::getInstance();
+
+ return array_merge(
+ // Default backend parameters
+ [
+ 'mimeCallback' => [ $this, 'guessMimeInternal' ],
+ 'obResetFunc' => 'wfResetOutputBuffers',
+ 'streamMimeFunc' => [ StreamFile::class, 'contentTypeFromPath' ],
+ 'tmpFileFactory' => $services->getTempFSFileFactory(),
+ 'statusWrapper' => [ Status::class, 'wrap' ],
+ 'wanCache' => $services->getMainWANObjectCache(),
+ 'srvCache' => ObjectCache::getLocalServerInstance( 'hash' ),
+ 'logger' => LoggerFactory::getInstance( 'FileOperation' ),
+ 'profiler' => function ( $section ) {
+ return Profiler::instance()->scopedProfileIn( $section );
+ }
+ ],
+ // Configured backend parameters
+ $config,
+ // Resolved backend parameters
+ [
+ 'class' => $this->backends[$name]['class'],
+ 'lockManager' =>
+ LockManagerGroup::singleton( $config['domainId'] )
+ ->get( $config['lockManager'] ),
+ 'fileJournal' => isset( $config['fileJournal'] )
+ ? FileJournal::factory( $config['fileJournal'], $name )
+ : FileJournal::factory( [ 'class' => NullFileJournal::class ], $name )
+ ]
+ );