Merge "Add CollationFa"
[lhc/web/wiklou.git] / includes / specials / SpecialFileDuplicateSearch.php
index 68960d3..8021bc2 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+use MediaWiki\MediaWikiServices;
+
 /**
  * Implements Special:FileDuplicateSearch
  *
@@ -118,19 +120,17 @@ class FileDuplicateSearchPage extends QueryPage {
                                'id' => 'filename',
                                'size' => 50,
                                'value' => $this->filename,
-                               'cssclass' => 'mw-ui-input-inline'
                        ],
                ];
                $hiddenFields = [
                        'title' => $this->getPageTitle()->getPrefixedDBkey(),
                ];
-               $htmlForm = HTMLForm::factory( 'inline', $formFields, $this->getContext() );
+               $htmlForm = HTMLForm::factory( 'ooui', $formFields, $this->getContext() );
                $htmlForm->addHiddenFields( $hiddenFields );
                $htmlForm->setAction( wfScript() );
                $htmlForm->setMethod( 'get' );
                $htmlForm->setSubmitProgressive();
                $htmlForm->setSubmitTextMsg( $this->msg( 'fileduplicatesearch-submit' ) );
-               $htmlForm->setWrapperLegendMsg( 'fileduplicatesearch-legend' );
 
                // The form should be visible always, even if it was submitted (e.g. to perform another action).
                // To bypass the callback validation of HTMLForm, use prepareForm() and displayForm().
@@ -208,11 +208,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' );
@@ -246,11 +247,11 @@ class FileDuplicateSearchPage extends QueryPage {
                        // No prefix suggestion outside of file namespace
                        return [];
                }
-               $search = SearchEngine::create();
-               $search->setLimitOffset( $limit, $offset );
+               $searchEngine = MediaWikiServices::getInstance()->newSearchEngine();
+               $searchEngine->setLimitOffset( $limit, $offset );
                // Autocomplete subpage the same as a normal search, but just for files
-               $search->setNamespaces( [ NS_FILE ] );
-               $result = $search->defaultPrefixSearch( $search );
+               $searchEngine->setNamespaces( [ NS_FILE ] );
+               $result = $searchEngine->defaultPrefixSearch( $search );
 
                return array_map( function ( Title $t ) {
                        // Remove namespace in search suggestion