search: Remove unused deprecated methods replaced by MW Services
authorDerick Alangi <alangiderick@gmail.com>
Thu, 18 Apr 2019 13:09:02 +0000 (14:09 +0100)
committerJforrester <jforrester@wikimedia.org>
Fri, 19 Apr 2019 00:09:42 +0000 (00:09 +0000)
The following methods deprecated in .27 and no longer used have
been removed;

- SearchEngine::userNamespaces()
  https://codesearch.wmflabs.org/search/?q=%3A%3AuserNamespaces&i=nope&files=&repos=

- SearchEngine::namespacesAsText()
  https://codesearch.wmflabs.org/search/?q=%3A%3AnamespacesAsText&i=nope&files=&repos=

- SearchEngine::create()
  https://codesearch.wmflabs.org/search/?q=SearchEngine%3A%3Acreate&i=nope&files=&repos=

- SearchEngine::getSearchTypes()
  https://codesearch.wmflabs.org/search/?q=%3A%3AgetSearchTypes&i=nope&files=&repos=

- SearchEngine::getNearMatch()
  https://codesearch.wmflabs.org/search/?q=SearchEngine%3A%3AgetNearMatch%5C(&i=nope&files=&repos=

Also, replace deprecated use of searchableNamespaces() in SearchEngine.

Bug: T220656
Change-Id: I330fbfea158f70b2328da7c850fdb833e39b6c7d

RELEASE-NOTES-1.34
includes/search/SearchEngine.php
includes/search/SearchNearMatcher.php

index a392ba1..ee1a319 100644 (file)
@@ -97,6 +97,9 @@ because of Phabricator reports.
   To obtain the destination title, use RedirectSpecialPage::getRedirect.
 * The 'recenteditcount' response property from action API action=query
   list=allusers, deprecated in 1.25, has been removed.
+* SearchEngine::userNamespaces(), SearchEngine::namespacesAsText(),
+  SearchEngine::create(), SearchEngine::getSearchTypes() and
+  SearchEngine::getNearMatch(), methods deprecated in 1.27, have been removed
 
 === Deprecations in 1.34 ===
 * The MWNamespace class is deprecated. Use MediaWikiServices::getNamespaceInfo.
index 3e3f96c..6bbcd4b 100644 (file)
@@ -268,19 +268,6 @@ abstract class SearchEngine {
                return $services->newSearchEngine()->getNearMatcher( $config );
        }
 
-       /**
-        * If an exact title match can be found, or a very slightly close match,
-        * return the title. If no match, returns NULL.
-        * @deprecated since 1.27; Use SearchEngine::getNearMatcher()
-        * @param string $searchterm
-        * @return Title
-        */
-       public static function getNearMatch( $searchterm ) {
-               wfDeprecated( __METHOD__, '1.27' );
-
-               return static::defaultNearMatcher()->getNearMatch( $searchterm );
-       }
-
        /**
         * Get chars legal for search
         * @param int $type type of search chars (see self::CHARS_ALL
@@ -731,79 +718,6 @@ abstract class SearchEngine {
                return $backend->defaultSearchBackend( $this->namespaces, $search, $this->limit, $this->offset );
        }
 
-       /**
-        * Make a list of searchable namespaces and their canonical names.
-        * @deprecated since 1.27; use SearchEngineConfig::searchableNamespaces()
-        * @return array
-        */
-       public static function searchableNamespaces() {
-               wfDeprecated( __METHOD__, '1.27' );
-
-               return MediaWikiServices::getInstance()->getSearchEngineConfig()->searchableNamespaces();
-       }
-
-       /**
-        * Extract default namespaces to search from the given user's
-        * settings, returning a list of index numbers.
-        * @deprecated since 1.27; use SearchEngineConfig::userNamespaces()
-        * @param user $user
-        * @return array
-        */
-       public static function userNamespaces( $user ) {
-               wfDeprecated( __METHOD__, '1.27' );
-
-               return MediaWikiServices::getInstance()->getSearchEngineConfig()->userNamespaces( $user );
-       }
-
-       /**
-        * An array of namespaces indexes to be searched by default
-        * @deprecated since 1.27; use SearchEngineConfig::defaultNamespaces()
-        * @return array
-        */
-       public static function defaultNamespaces() {
-               wfDeprecated( __METHOD__, '1.27' );
-
-               return MediaWikiServices::getInstance()->getSearchEngineConfig()->defaultNamespaces();
-       }
-
-       /**
-        * Get a list of namespace names useful for showing in tooltips
-        * and preferences
-        * @deprecated since 1.27; use SearchEngineConfig::namespacesAsText()
-        * @param array $namespaces
-        * @return array
-        */
-       public static function namespacesAsText( $namespaces ) {
-               wfDeprecated( __METHOD__, '1.27' );
-
-               return MediaWikiServices::getInstance()->getSearchEngineConfig()->namespacesAsText( $namespaces );
-       }
-
-       /**
-        * Load up the appropriate search engine class for the currently
-        * active database backend, and return a configured instance.
-        * @deprecated since 1.27; Use SearchEngineFactory::create
-        * @param string $type Type of search backend, if not the default
-        * @return SearchEngine
-        */
-       public static function create( $type = null ) {
-               wfDeprecated( __METHOD__, '1.27' );
-
-               return MediaWikiServices::getInstance()->getSearchEngineFactory()->create( $type );
-       }
-
-       /**
-        * Return the search engines we support. If only $wgSearchType
-        * is set, it'll be an array of just that one item.
-        * @deprecated since 1.27; use SearchEngineConfig::getSearchTypes()
-        * @return array
-        */
-       public static function getSearchTypes() {
-               wfDeprecated( __METHOD__, '1.27' );
-
-               return MediaWikiServices::getInstance()->getSearchEngineConfig()->getSearchTypes();
-       }
-
        /**
         * Get a list of supported profiles.
         * Some search engine implementations may expose specific profiles to fine-tune
index 0a64493..9ee3e17 100644 (file)
@@ -165,7 +165,7 @@ class SearchNearMatcher {
                # Quoted term? Try without the quotes...
                $matches = [];
                if ( preg_match( '/^"([^"]+)"$/', $searchterm, $matches ) ) {
-                       return self::getNearMatch( $matches[1] );
+                       return $this->getNearMatch( $matches[1] );
                }
 
                return null;