'wikiId' => wfWikiId(),
'containerPaths' => $containers
) );
- $this->repo = new FSRepo( array(
+ $this->repo = new FSRepo( $this->getRepoOptions() );
+ }
+
+ /**
+ * @return Array Argument for FSRepo constructor
+ */
+ protected function getRepoOptions() {
+ return array(
'name' => 'temp',
'url' => 'http://localhost/thumbtest',
'backend' => $this->backend
- ) );
+ );
}
/**
*
* File must be in the path returned by getFilePath()
* @param $name String File name
- * @param $type String MIME type
+ * @param $type String MIME type [optional]
* @return UnregisteredLocalFile
*/
- protected function dataFile( $name, $type ) {
+ protected function dataFile( $name, $type = null ) {
+ if ( !$type ) {
+ // Autodetect by file extension for the lazy.
+ $magic = MimeMagic::singleton();
+ $parts = explode( $name, '.' );
+ $type = $magic->guessTypesForExtension( $parts[count( $parts ) - 1] );
+ }
return new UnregisteredLocalFile( false, $this->repo,
"mwstore://localtesting/data/$name", $type );
}