<?php
+use MediaWiki\MediaWikiServices;
+
/**
* Content handler for File: files
* TODO: this handler s not used directly now,
class FileContentHandler extends WikitextContentHandler {
public function getFieldsForSearchIndex( SearchEngine $engine ) {
+ $fields = [];
$fields['file_media_type'] =
$engine->makeSearchFieldMapping( 'file_media_type', SearchIndexField::INDEX_TYPE_KEYWORD );
$fields['file_media_type']->setFlag( SearchIndexField::FLAG_CASEFOLD );
if ( NS_FILE != $title->getNamespace() ) {
return [];
}
- $file = wfLocalFile( $title );
+ $file = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
+ ->newFile( $title );
if ( !$file || !$file->exists() ) {
return [];
}