Remove a bit of useless $wgCapitalLinks logic, all these code paths lead through...
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 25 Jul 2008 23:12:27 +0000 (23:12 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 25 Jul 2008 23:12:27 +0000 (23:12 +0000)
*In SearchEngine's case, it gets caught every time further up the page (it never even reaches the upper/lower casing of only first character part)
*PrefixSearch eventually sends it through ApiQueryBase::titleToKey()
*AjaxFunctions immediately sends it to Title::newFromText()

includes/AjaxFunctions.php
includes/PrefixSearch.php
includes/SearchEngine.php

index 9daca9e..327dead 100644 (file)
@@ -75,15 +75,13 @@ function code2utf($num){
 define( 'AJAX_SEARCH_VERSION', 2 );    //AJAX search cache version
 
 function wfSajaxSearch( $term ) {
-       global $wgContLang, $wgUser, $wgCapitalLinks, $wgMemc;
+       global $wgContLang, $wgUser, $wgMemc;
        $limit = 16;
        $sk = $wgUser->getSkin();
        $output = '';
 
        $term = trim( $term );
        $term = $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) );
-       if ( $wgCapitalLinks )
-               $term = $wgContLang->ucfirst( $term );
        $term_title = Title::newFromText( $term );
 
        $memckey = $term_title ? wfMemcKey( 'ajaxsearch', md5( $term_title->getFullText() ) ) : wfMemcKey( 'ajaxsearch', md5( $term ) );
index a3ff05e..17f8ec1 100644 (file)
@@ -96,7 +96,9 @@ class PrefixSearch {
 
        /**
         * Unless overridden by PrefixSearchBackend hook...
-        * This is case-sensitive except the first letter (per $wgCapitalLinks)
+        * This is case-sensitive (First character may
+        * be automatically capitalized by Title::secureAndSpit()
+        * later on depending on $wgCapitalLinks)
         *
         * @param array $namespaces Namespaces to search in
         * @param string $search term
@@ -104,12 +106,6 @@ class PrefixSearch {
         * @return array of title strings
         */
        protected static function defaultSearchBackend( $namespaces, $search, $limit ) {
-               global $wgCapitalLinks, $wgContLang;
-
-               if( $wgCapitalLinks ) {
-                       $search = $wgContLang->ucfirst( $search );
-               }
-
                $ns = array_shift($namespaces); // support only one namespace
                if( in_array(NS_MAIN,$namespaces))
                        $ns = NS_MAIN; // if searching on many always default to main 
index 04fa906..fae5edc 100644 (file)
@@ -98,19 +98,6 @@ class SearchEngine {
                                return $title;
                        }
 
-                       global $wgCapitalLinks, $wgContLang;
-                       if( !$wgCapitalLinks ) {
-                               // Catch differs-by-first-letter-case-only
-                               $title = Title::newFromText( $wgContLang->ucfirst( $term ) );
-                               if ( $title && $title->exists() ) {
-                                       return $title;
-                               }
-                               $title = Title::newFromText( $wgContLang->lcfirst( $term ) );
-                               if ( $title && $title->exists() ) {
-                                       return $title;
-                               }
-                       }
-
                        // Give hooks a chance at better match variants
                        $title = null;
                        if( !wfRunHooks( 'SearchGetNearMatch', array( $term, &$title ) ) ) {