From 63601400e476c6cf43d985f3e7b9864681695ed4 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Jan 2013 16:46:04 +0100 Subject: Update to MediaWiki 1.20.2 this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024 --- includes/search/SearchEngine.php | 47 +++++++++++++++++++++++--------------- includes/search/SearchIBM_DB2.php | 5 +++- includes/search/SearchMssql.php | 7 +++++- includes/search/SearchMySQL.php | 5 +++- includes/search/SearchOracle.php | 4 +++- includes/search/SearchPostgres.php | 1 + includes/search/SearchSqlite.php | 1 + includes/search/SearchUpdate.php | 15 ++++++++++++ 8 files changed, 63 insertions(+), 22 deletions(-) (limited to 'includes/search') diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 2f7dfd7e..27a321ac 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -2,6 +2,21 @@ /** * Basic search engine * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * * @file * @ingroup Search */ @@ -65,6 +80,7 @@ class SearchEngine { /** * If this search backend can list/unlist redirects * @deprecated since 1.18 Call supports( 'list-redirects' ); + * @return bool */ function acceptListRedirects() { wfDeprecated( __METHOD__, '1.18' ); @@ -91,7 +107,7 @@ class SearchEngine { * @since 1.18 * @param $feature String * @param $data Mixed - * @return Noolean + * @return bool */ public function setFeatureData( $feature, $data ) { $this->features[$feature] = $data; @@ -147,6 +163,7 @@ class SearchEngine { /** * Really find the title match. + * @return null|\Title */ private static function getNearMatchInternal( $searchterm ) { global $wgContLang, $wgEnableSearchContributorsByIP; @@ -287,6 +304,7 @@ class SearchEngine { * or namespace names * * @param $query String + * @return string */ function replacePrefixes( $query ) { global $wgContLang; @@ -297,7 +315,7 @@ class SearchEngine { return $parsed; } - $allkeyword = wfMsgForContent( 'searchall' ) . ":"; + $allkeyword = wfMessage( 'searchall' )->inContentLanguage()->text() . ":"; if ( strncmp( $query, $allkeyword, strlen( $allkeyword ) ) == 0 ) { $this->namespaces = null; $parsed = substr( $query, strlen( $allkeyword ) ); @@ -391,6 +409,7 @@ class SearchEngine { * and preferences * * @param $namespaces Array + * @return array */ public static function namespacesAsText( $namespaces ) { global $wgContLang; @@ -398,7 +417,7 @@ class SearchEngine { $formatted = array_map( array( $wgContLang, 'getFormattedNsText' ), $namespaces ); foreach ( $formatted as $key => $ns ) { if ( empty( $ns ) ) - $formatted[$key] = wfMsg( 'blanknamespace' ); + $formatted[$key] = wfMessage( 'blanknamespace' )->text(); } return $formatted; } @@ -486,19 +505,6 @@ class SearchEngine { return $wgCanonicalServer . wfScript( 'api' ) . '?action=opensearch&search={searchTerms}&namespace=' . $ns; } } - - /** - * Get internal MediaWiki Suggest template - * - * @return String - */ - public static function getMWSuggestTemplate() { - global $wgMWSuggestTemplate, $wgServer; - if ( $wgMWSuggestTemplate ) - return $wgMWSuggestTemplate; - else - return $wgServer . wfScript( 'api' ) . '?action=opensearch&search={searchTerms}&namespace={namespaces}&suggest'; - } } /** @@ -737,7 +743,10 @@ class SearchResult { protected function initFromTitle( $title ) { $this->mTitle = $title; if ( !is_null( $this->mTitle ) ) { - $this->mRevision = Revision::newFromTitle( $this->mTitle ); + $id = false; + wfRunHooks( 'SearchResultInitFromTitle', array( $title, &$id ) ); + $this->mRevision = Revision::newFromTitle( + $this->mTitle, $id, Revision::READ_NORMAL ); if ( $this->mTitle->getNamespace() === NS_FILE ) $this->mImage = wfFindFile( $this->mTitle ); } @@ -771,7 +780,7 @@ class SearchResult { } /** - * @return Double or null if not supported + * @return float|null if not supported */ function getScore() { return null; @@ -1185,6 +1194,7 @@ class SearchHighlighter { * Do manual case conversion for non-ascii chars * * @param $matches Array + * @return string */ function caseCallback( $matches ) { global $wgContLang; @@ -1305,6 +1315,7 @@ class SearchHighlighter { /** * Basic wikitext removal * @protected + * @return mixed */ function removeWiki( $text ) { $fname = __METHOD__; diff --git a/includes/search/SearchIBM_DB2.php b/includes/search/SearchIBM_DB2.php index c02a009d..51ed000f 100644 --- a/includes/search/SearchIBM_DB2.php +++ b/includes/search/SearchIBM_DB2.php @@ -111,6 +111,7 @@ class SearchIBM_DB2 extends SearchEngine { * The guts shoulds be constructed in queryMain() * @param $filteredTerm String * @param $fulltext Boolean + * @return String */ function getQuery( $filteredTerm, $fulltext ) { return $this->queryLimit($this->queryMain($filteredTerm, $fulltext) . ' ' . @@ -145,7 +146,9 @@ class SearchIBM_DB2 extends SearchEngine { 'WHERE page_id=si_page AND ' . $match; } - /** @todo document */ + /** @todo document + * @return string + */ function parseQuery($filteredText, $fulltext) { global $wgContLang; $lc = SearchEngine::legalSearchChars(); diff --git a/includes/search/SearchMssql.php b/includes/search/SearchMssql.php index ebf19d3a..69c92ba3 100644 --- a/includes/search/SearchMssql.php +++ b/includes/search/SearchMssql.php @@ -115,6 +115,7 @@ class SearchMssql extends SearchEngine { * * @param $filteredTerm String * @param $fulltext Boolean + * @return String */ function getQuery( $filteredTerm, $fulltext ) { return $this->queryLimit( $this->queryMain( $filteredTerm, $fulltext ) . ' ' . @@ -151,7 +152,9 @@ class SearchMssql extends SearchEngine { 'WHERE page_id=ftindex.[KEY] '; } - /** @todo document */ + /** @todo document + * @return string + */ function parseQuery( $filteredText, $fulltext ) { global $wgContLang; $lc = SearchEngine::legalSearchChars(); @@ -189,6 +192,7 @@ class SearchMssql extends SearchEngine { * @param $id Integer * @param $title String * @param $text String + * @return bool|\ResultWrapper */ function update( $id, $title, $text ) { // We store the column data as UTF-8 byte order marked binary stream @@ -211,6 +215,7 @@ class SearchMssql extends SearchEngine { * * @param $id Integer * @param $title String + * @return bool|\ResultWrapper */ function updateTitle( $id, $title ) { $table = $this->db->tableName( 'searchindex' ); diff --git a/includes/search/SearchMySQL.php b/includes/search/SearchMySQL.php index af8f3875..5cee03e0 100644 --- a/includes/search/SearchMySQL.php +++ b/includes/search/SearchMySQL.php @@ -290,7 +290,7 @@ class SearchMySQL extends SearchEngine { /** * Get the base part of the search query. * - * @param &$query Search query array + * @param &$query array Search query array * @param $filteredTerm String * @param $fulltext Boolean * @since 1.18 (changed) @@ -308,6 +308,7 @@ class SearchMySQL extends SearchEngine { /** * @since 1.18 (changed) + * @return array */ function getCountQuery( $filteredTerm, $fulltext ) { $match = $this->parseQuery( $filteredTerm, $fulltext ); @@ -365,6 +366,7 @@ class SearchMySQL extends SearchEngine { /** * Converts some characters for MySQL's indexing to grok it correctly, * and pads short words to overcome limitations. + * @return mixed|string */ function normalizeText( $string ) { global $wgContLang; @@ -412,6 +414,7 @@ class SearchMySQL extends SearchEngine { * Armor a case-folded UTF-8 string to get through MySQL's * fulltext search without being mucked up by funny charset * settings or anything else of the sort. + * @return string */ protected function stripForSearchCallback( $matches ) { return 'u8' . bin2hex( $matches[1] ); diff --git a/includes/search/SearchOracle.php b/includes/search/SearchOracle.php index 2d6fc3e2..a2db52f3 100644 --- a/includes/search/SearchOracle.php +++ b/includes/search/SearchOracle.php @@ -124,7 +124,7 @@ class SearchOracle extends SearchEngine { /** * Return a LIMIT clause to limit results on the query. * - * @param string + * @param $sql string * * @return String */ @@ -147,6 +147,7 @@ class SearchOracle extends SearchEngine { * The guts shoulds be constructed in queryMain() * @param $filteredTerm String * @param $fulltext Boolean + * @return String */ function getQuery( $filteredTerm, $fulltext ) { return $this->queryLimit($this->queryMain($filteredTerm, $fulltext) . ' ' . @@ -184,6 +185,7 @@ class SearchOracle extends SearchEngine { /** * Parse a user input search string, and return an SQL fragment to be used * as part of a WHERE clause + * @return string */ function parseQuery($filteredText, $fulltext) { global $wgContLang; diff --git a/includes/search/SearchPostgres.php b/includes/search/SearchPostgres.php index cfe283b2..68648894 100644 --- a/includes/search/SearchPostgres.php +++ b/includes/search/SearchPostgres.php @@ -146,6 +146,7 @@ class SearchPostgres extends SearchEngine { * @param $term String * @param $fulltext String * @param $colname + * @return string */ function searchQuery( $term, $fulltext, $colname ) { # Get the SQL fragment for the given term diff --git a/includes/search/SearchSqlite.php b/includes/search/SearchSqlite.php index cd59eea9..e52e4fe3 100644 --- a/includes/search/SearchSqlite.php +++ b/includes/search/SearchSqlite.php @@ -238,6 +238,7 @@ class SearchSqlite extends SearchEngine { * The guts shoulds be constructed in queryMain() * @param $filteredTerm String * @param $fulltext Boolean + * @return String */ function getQuery( $filteredTerm, $fulltext ) { return $this->limitResult( diff --git a/includes/search/SearchUpdate.php b/includes/search/SearchUpdate.php index a162d2b3..40dd36c2 100644 --- a/includes/search/SearchUpdate.php +++ b/includes/search/SearchUpdate.php @@ -4,6 +4,21 @@ * * See deferred.txt * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * * @file * @ingroup Search */ -- cgit v1.2.2