Title and redirect snippets don't have a parameter anymore
[lhc/web/wiklou.git] / includes / specials / SpecialSearch.php
index 9e5143f..81077a9 100644 (file)
@@ -105,7 +105,6 @@ class SpecialSearch extends SpecialPage {
 
                if ( $request->getVal( 'fulltext' )
                        || !is_null( $request->getVal( 'offset' ) )
-                       || !is_null( $request->getVal( 'searchx' ) )
                ) {
                        $this->showResults( $search );
                } else {
@@ -120,7 +119,7 @@ class SpecialSearch extends SpecialPage {
         */
        public function load() {
                $request = $this->getRequest();
-               list( $this->limit, $this->offset ) = $request->getLimitOffset( 20, '', 500 );
+               list( $this->limit, $this->offset ) = $request->getLimitOffset( 20 );
                $this->mPrefix = $request->getVal( 'prefix', '' );
 
                $user = $this->getUser();
@@ -199,7 +198,7 @@ class SpecialSearch extends SpecialPage {
                if ( !is_null( $t ) ) {
                        global $wgGoToEdit;
                        wfRunHooks( 'SpecialSearchNogomatch', array( &$t ) );
-                       wfDebugLog( 'nogomatch', $t->getText(), false );
+                       wfDebugLog( 'nogomatch', $t->getText(), 'private' );
 
                        # If the feature is enabled, go straight to the edit page
                        if ( $wgGoToEdit ) {
@@ -376,7 +375,7 @@ class SpecialSearch extends SpecialPage {
                // prev/next links
                if ( $num || $this->offset ) {
                        // Show the create link ahead
-                       $this->showCreateLink( $t, $num );
+                       $this->showCreateLink( $t, $num, $titleMatches, $textMatches );
                        $prevnext = $this->getLanguage()->viewPrevNext( $this->getPageTitle(), $this->offset, $this->limit,
                                $this->powerSearchOptions() + array( 'search' => $term ),
                                max( $titleMatchesNum, $textMatchesNum ) < $this->limit
@@ -422,7 +421,7 @@ class SpecialSearch extends SpecialPage {
                        } else {
                                $out->wrapWikiMsg( "<p class=\"mw-search-nonefound\">\n$1</p>",
                                        array( 'search-nonefound', wfEscapeWikiText( $term ) ) );
-                               $this->showCreateLink( $t, $num );
+                               $this->showCreateLink( $t, $num, $titleMatches, $textMatches );
                        }
                }
                $out->addHtml( "</div>" );
@@ -437,12 +436,16 @@ class SpecialSearch extends SpecialPage {
        /**
         * @param $t Title
         * @param int $num The number of search results found
+        * @param $titleMatches null|SearchResultSet results from title search
+        * @param $textMatches null|SearchResultSet results from text search
         */
-       protected function showCreateLink( $t, $num ) {
+       protected function showCreateLink( $t, $num, $titleMatches, $textMatches ) {
                // show direct page/create link if applicable
 
                // Check DBkey !== '' in case of fragment link only.
-               if ( is_null( $t ) || $t->getDBkey() === '' ) {
+               if ( is_null( $t ) || $t->getDBkey() === '' ||
+                               ( $titleMatches !== null && $titleMatches->searchContainedSyntax() ) ||
+                               ( $textMatches !== null && $textMatches->searchContainedSyntax() ) ) {
                        // invalid title
                        // preserve the paragraph for margins etc...
                        $this->getOutput()->addHtml( '<p></p>' );
@@ -803,7 +806,7 @@ class SpecialSearch extends SpecialPage {
 
                $t = $result->getTitle();
 
-               $titleSnippet = $result->getTitleSnippet( $terms );
+               $titleSnippet = $result->getTitleSnippet();
 
                if ( $titleSnippet == '' ) {
                        $titleSnippet = null;
@@ -816,7 +819,7 @@ class SpecialSearch extends SpecialPage {
 
                // format redirect if any
                $redirectTitle = $result->getRedirectTitle();
-               $redirectText = $result->getRedirectSnippet( $terms );
+               $redirectText = $result->getRedirectSnippet();
                $redirect = '';
                if ( !is_null( $redirectTitle ) ) {
                        if ( $redirectText == '' ) {