diff options
Diffstat (limited to 'includes/search/SearchUpdate.php')
-rw-r--r-- | includes/search/SearchUpdate.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/includes/search/SearchUpdate.php b/includes/search/SearchUpdate.php index 40dd36c2..eabcda3e 100644 --- a/includes/search/SearchUpdate.php +++ b/includes/search/SearchUpdate.php @@ -34,7 +34,12 @@ class SearchUpdate implements DeferrableUpdate { private $mTitleWords; function __construct( $id, $title, $text = false ) { - $nt = Title::newFromText( $title ); + if ( is_string( $title ) ) { + $nt = Title::newFromText( $title ); + } else { + $nt = $title; + } + if( $nt ) { $this->mId = $id; $this->mText = $text; @@ -74,7 +79,7 @@ class SearchUpdate implements DeferrableUpdate { $text = preg_replace( "/<\\/?\\s*[A-Za-z][^>]*?>/", ' ', $wgContLang->lc( " " . $text . " " ) ); # Strip HTML markup $text = preg_replace( "/(^|\\n)==\\s*([^\\n]+)\\s*==(\\s)/sD", - "\\1\\2 \\2 \\2\\3", $text ); # Emphasize headings + "\\1\\2 \\2 \\2\\3", $text ); # Emphasize headings # Strip external URLs $uc = "A-Za-z0-9_\\/:.,~%\\-+&;#?!=()@\\x80-\\xFF"; @@ -92,7 +97,7 @@ class SearchUpdate implements DeferrableUpdate { $text = preg_replace( $pat2, " \\1 \\3", $text ); $text = preg_replace( "/([^{$lc}])([{$lc}]+)]]([a-z]+)/", - "\\1\\2 \\2\\3", $text ); # Handle [[game]]s + "\\1\\2 \\2\\3", $text ); # Handle [[game]]s # Strip all remaining non-search characters $text = preg_replace( "/[^{$lc}]+/", " ", $text ); @@ -122,7 +127,7 @@ class SearchUpdate implements DeferrableUpdate { wfRunHooks( 'SearchUpdate', array( $this->mId, $this->mNamespace, $this->mTitle, &$text ) ); # Perform the actual update - $search->update($this->mId, $search->normalizeText( Title::indexTitle( $this->mNamespace, $this->mTitle ) ), + $search->update( $this->mId, $search->normalizeText( Title::indexTitle( $this->mNamespace, $this->mTitle ) ), $search->normalizeText( $text ) ); wfProfileOut( __METHOD__ ); |