X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSearchUpdate.php;h=087a8ba5dc7979b43450dca552ad4c31b802e35f;hb=797c7653cf29930b389e0d39117ec550663a888c;hp=8e0b74f32f88cea464cafd653963205fa0fa566c;hpb=811f7fb65be6587a5c5cad792b4a87d800a50414;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SearchUpdate.php b/includes/SearchUpdate.php index 8e0b74f32f..087a8ba5dc 100644 --- a/includes/SearchUpdate.php +++ b/includes/SearchUpdate.php @@ -1,12 +1,7 @@ mId ) { return false; @@ -37,11 +32,10 @@ class SearchUpdate { $fname = 'SearchUpdate::doUpdate'; wfProfileIn( $fname ); - require_once( 'SearchEngine.php' ); - $search =& SearchEngine::create(); - $lc = $search->legalSearchChars() . '&#;'; - - if( $this->mText == false ) { + $search = SearchEngine::create(); + $lc = SearchEngine::legalSearchChars() . '&#;'; + + if( $this->mText === false ) { $search->updateTitle($this->mId, Title::indexTitle( $this->mNamespace, $this->mTitle )); wfProfileOut( $fname ); @@ -54,8 +48,8 @@ class SearchUpdate { wfProfileIn( $fname.'-regexps' ); $text = preg_replace( "/<\\/?\\s*[A-Za-z][A-Za-z0-9]*\\s*([^>]*?)>/", ' ', strtolower( " " . $text /*$this->mText*/ . " " ) ); # Strip HTML markup - $text = preg_replace( "/(^|\\n)\\s*==\\s+([^\\n]+)\\s+==\\s/sD", - "\\2 \\2 \\2 ", $text ); # Emphasize headings + $text = preg_replace( "/(^|\\n)==\\s*([^\\n]+)\\s*==(\\s)/sD", + "\\1\\2 \\2 \\2\\3", $text ); # Emphasize headings # Strip external URLs $uc = "A-Za-z0-9_\\/:.,~%\\-+&;#?!=()@\\xA0-\\xFF"; @@ -99,15 +93,21 @@ class SearchUpdate { # Strip wiki '' and ''' $text = preg_replace( "/''[']*/", " ", $text ); wfProfileOut( "$fname-regexps" ); + + wfRunHooks( 'SearchUpdate', array( $this->mId, $this->mNamespace, $this->mTitle, &$text ) ); + + # Perform the actual update $search->update($this->mId, Title::indexTitle( $this->mNamespace, $this->mTitle ), $text); + wfProfileOut( $fname ); } } -/* Placeholder class */ +/** + * Placeholder class + * @ingroup Search + */ class SearchUpdateMyISAM extends SearchUpdate { # Inherits everything } - -?>