<?php
+use MediaWiki\MediaWikiServices;
+
/**
* Content handler for File: files
* TODO: this handler s not used directly now,
* but instead manually called by WikitextHandler.
* This should be fixed in the future.
*/
-class FileContentHandler extends WikitextContentHandler {
+class FileContentHandler extends WikitextContentHandler {
public function getFieldsForSearchIndex( SearchEngine $engine ) {
$fields['file_media_type'] =
return $fields;
}
- public function getDataForSearchIndex( WikiPage $page, ParserOutput $parserOutput,
- SearchEngine $engine ) {
+ public function getDataForSearchIndex(
+ WikiPage $page,
+ ParserOutput $parserOutput,
+ SearchEngine $engine
+ ) {
$fields = [];
$title = $page->getTitle();
if ( NS_FILE != $title->getNamespace() ) {
return [];
}
- $file = wfLocalFile( $title );
+ $file = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
+ ->newFile( $title );
if ( !$file || !$file->exists() ) {
return [];
}