dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Let findHooks.php find UserCreateForm/UserLoginForm"
[lhc/web/wiklou.git]
/
includes
/
deferred
/
SearchUpdate.php
diff --git
a/includes/deferred/SearchUpdate.php
b/includes/deferred/SearchUpdate.php
index
2abf028
..
b9a259b
100644
(file)
--- a/
includes/deferred/SearchUpdate.php
+++ b/
includes/deferred/SearchUpdate.php
@@
-23,6
+23,8
@@
* @ingroup Search
*/
* @ingroup Search
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Database independant search index updater
*
/**
* Database independant search index updater
*
@@
-75,14
+77,15
@@
class SearchUpdate implements DeferrableUpdate {
* Perform actual update for the entry
*/
public function doUpdate() {
* Perform actual update for the entry
*/
public function doUpdate() {
-
global $wgDisableSearchUpdate
;
+
$config = MediaWikiServices::getInstance()->getSearchEngineConfig()
;
- if ( $
wgDisableSearchUpdate
|| !$this->id ) {
+ if ( $
config->getConfig()->get( 'DisableSearchUpdate' )
|| !$this->id ) {
return;
}
return;
}
- foreach ( SearchEngine::getSearchTypes() as $type ) {
- $search = SearchEngine::create( $type );
+ $seFactory = MediaWikiServices::getInstance()->getSearchEngineFactory();
+ foreach ( $config->getSearchTypes() as $type ) {
+ $search = $seFactory->create( $type );
if ( !$search->supports( 'search-update' ) ) {
continue;
}
if ( !$search->supports( 'search-update' ) ) {
continue;
}
@@
-99,13
+102,12
@@
class SearchUpdate implements DeferrableUpdate {
$text = $search->getTextFromContent( $this->title, $this->content );
if ( !$search->textAlreadyUpdatedForIndex() ) {
$text = $search->getTextFromContent( $this->title, $this->content );
if ( !$search->textAlreadyUpdatedForIndex() ) {
- $text =
self::updateText( $text
);
+ $text =
$this->updateText( $text, $search
);
}
# Perform the actual update
$search->update( $this->id, $normalTitle, $search->normalizeText( $text ) );
}
}
# Perform the actual update
$search->update( $this->id, $normalTitle, $search->normalizeText( $text ) );
}
-
}
/**
}
/**
@@
-113,14
+115,16
@@
class SearchUpdate implements DeferrableUpdate {
* If you're using a real search engine, you'll probably want to override
* this behavior and do something nicer with the original wikitext.
* @param string $text
* If you're using a real search engine, you'll probably want to override
* this behavior and do something nicer with the original wikitext.
* @param string $text
+ * @param SearchEngine $se Search engine
* @return string
*/
* @return string
*/
- public
static function updateText( $text
) {
+ public
function updateText( $text, SearchEngine $se = null
) {
global $wgContLang;
# Language-specific strip/conversion
$text = $wgContLang->normalizeForSearch( $text );
global $wgContLang;
# Language-specific strip/conversion
$text = $wgContLang->normalizeForSearch( $text );
- $lc = SearchEngine::legalSearchChars() . '&#;';
+ $se = $se ?: MediaWikiServices::getInstance()->newSearchEngine();
+ $lc = $se->legalSearchChars() . '&#;';
$text = preg_replace( "/<\\/?\\s*[A-Za-z][^>]*?>/",
' ', $wgContLang->lc( " " . $text . " " ) ); # Strip HTML markup
$text = preg_replace( "/<\\/?\\s*[A-Za-z][^>]*?>/",
' ', $wgContLang->lc( " " . $text . " " ) ); # Strip HTML markup