* Non-working API to facilitate dev collaboration. Do not enable this yet in localset...
[lhc/web/wiklou.git] / includes / SearchUpdate.php
index 57f9911..37981a6 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * See deferred.doc
+ * See deferred.txt
  * @package MediaWiki
  */
 
@@ -29,7 +29,7 @@ class SearchUpdate {
        }
 
        function doUpdate() {
-               global $wgDBminWordLen, $wgContLang, $wgDisableSearchUpdate;
+               global $wgContLang, $wgDisableSearchUpdate;
 
                if( $wgDisableSearchUpdate || !$this->mId ) {
                        return false;
@@ -37,11 +37,10 @@ class SearchUpdate {
                $fname = 'SearchUpdate::doUpdate';
                wfProfileIn( $fname );
 
-               require_once( 'SearchEngine.php' );
-               $search =& SearchEngine::create();
+               $search = SearchEngine::create();
                $lc = $search->legalSearchChars() . '&#;';
-               
-               if( $this->mText == false ) {
+
+               if( $this->mText === false ) {
                        $search->updateTitle($this->mId,
                                Title::indexTitle( $this->mNamespace, $this->mTitle ));
                        wfProfileOut( $fname );
@@ -54,8 +53,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";