Replace some uses of deprecated wfFindFile() and wfLocalFile()
[lhc/web/wiklou.git] / includes / search / SearchResult.php
index 2f20d9d..7e51432 100644 (file)
@@ -66,7 +66,7 @@ class SearchResult {
         * Return a new SearchResult and initializes it with a title.
         *
         * @param Title $title
-        * @param SearchResultSet $parentSet
+        * @param SearchResultSet|null $parentSet
         * @return SearchResult
         */
        public static function newFromTitle( $title, SearchResultSet $parentSet = null ) {
@@ -86,16 +86,17 @@ class SearchResult {
         */
        protected function initFromTitle( $title ) {
                $this->mTitle = $title;
+               $services = MediaWikiServices::getInstance();
                if ( !is_null( $this->mTitle ) ) {
                        $id = false;
                        Hooks::run( 'SearchResultInitFromTitle', [ $title, &$id ] );
                        $this->mRevision = Revision::newFromTitle(
                                $this->mTitle, $id, Revision::READ_NORMAL );
                        if ( $this->mTitle->getNamespace() === NS_FILE ) {
-                               $this->mImage = wfFindFile( $this->mTitle );
+                               $this->mImage = $services->getRepoGroup()->findFile( $this->mTitle );
                        }
                }
-               $this->searchEngine = MediaWikiServices::getInstance()->newSearchEngine();
+               $this->searchEngine = $services->newSearchEngine();
        }
 
        /**
@@ -285,7 +286,7 @@ class SearchResult {
                if ( $extensionData instanceof Closure ) {
                        $this->extensionData = $extensionData;
                } elseif ( is_array( $extensionData ) ) {
-                       wfDeprecated( __METHOD__ . ' with array argument', 1.32 );
+                       wfDeprecated( __METHOD__ . ' with array argument', '1.32' );
                        $this->extensionData = function () use ( $extensionData ) {
                                return $extensionData;
                        };