Merge "Revert "Log the reason why revision->getContent() returns null""
[lhc/web/wiklou.git] / includes / specials / SpecialFileDuplicateSearch.php
index bb82d03..7694a61 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+use MediaWiki\MediaWikiServices;
+
 /**
  * Implements Special:FileDuplicateSearch
  *
@@ -83,15 +85,17 @@ class FileDuplicateSearchPage extends QueryPage {
        }
 
        public function getQueryInfo() {
+               $imgQuery = LocalFile::getQueryInfo();
                return [
-                       'tables' => [ 'image' ],
+                       'tables' => $imgQuery['tables'],
                        'fields' => [
                                'title' => 'img_name',
                                'value' => 'img_sha1',
-                               'img_user_text',
+                               'img_user_text' => $imgQuery['fields']['img_user_text'],
                                'img_timestamp'
                        ],
-                       'conds' => [ 'img_sha1' => $this->hash ]
+                       'conds' => [ 'img_sha1' => $this->hash ],
+                       'join_conds' => $imgQuery['joins'],
                ];
        }
 
@@ -206,11 +210,12 @@ class FileDuplicateSearchPage extends QueryPage {
        function formatResult( $skin, $result ) {
                global $wgContLang;
 
+               $linkRenderer = $this->getLinkRenderer();
                $nt = $result->getTitle();
                $text = $wgContLang->convert( $nt->getText() );
-               $plink = Linker::link(
+               $plink = $linkRenderer->makeLink(
                        $nt,
-                       htmlspecialchars( $text )
+                       $text
                );
 
                $userText = $result->getUser( 'text' );
@@ -244,7 +249,7 @@ class FileDuplicateSearchPage extends QueryPage {
                        // No prefix suggestion outside of file namespace
                        return [];
                }
-               $searchEngine = SearchEngine::create();
+               $searchEngine = MediaWikiServices::getInstance()->newSearchEngine();
                $searchEngine->setLimitOffset( $limit, $offset );
                // Autocomplete subpage the same as a normal search, but just for files
                $searchEngine->setNamespaces( [ NS_FILE ] );