* Removed section edit links in edit conflict form
* Allow SpecialActiveusers to work on non-MySQL databases
* (bug 6579) Fixed protecting images from uploading only
+* (bug 18609) Search index was empty for some pages
== API changes in 1.16 ==
$text = $wgContLang->stripForSearch( $this->mText );
wfProfileIn( $fname.'-regexps' );
- $text = preg_replace( "/<\\/?\\s*[A-Za-z][A-Za-z0-9]*\\s*([^>]*?)>/",
+ $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
--- /dev/null
+<?php
+/**
+ * Mock database class for tests, does nothing.
+ * Include after LocalSettings.php
+ */
+
+$wgDBtype = 'mock';
+
+class DatabaseMock extends DatabaseBase {
+ function __construct( $server = false, $user = false, $password = false, $dbName = false,
+ $failFunction = false, $flags = 0, $tablePrefix = 'get from global' )
+ {
+ $this->mConn = true;
+ $this->mOpened = true;
+ }
+
+ function open( $server, $user, $password, $dbName ) { return true; }
+ function doQuery( $sql ) {}
+ function fetchObject( $res ) {}
+ function fetchRow( $res ) {}
+ function numRows( $res ) {}
+ function numFields( $res ) {}
+ function fieldName( $res, $n ) {}
+ function insertId() {}
+ function dataSeek( $res, $row ) {}
+ function lastErrno() { return 0; }
+ function lastError() { return ''; }
+ function affectedRows() {}
+ function fieldInfo( $table, $field ) {}
+ function strencode( $s ) {}
+ function getSoftwareLink() {}
+ function getServerVersion() {}
+}
\ No newline at end of file
--- /dev/null
+#!/usr/bin/env php\r
+<?php\r
+\r
+require 't/Test.php';\r
+\r
+plan( 4 );\r
+\r
+define( 'MEDIAWIKI', 1 );\r
+require 'includes/Defines.php';\r
+require 'includes/ProfilerStub.php';\r
+require 'includes/AutoLoader.php';\r
+require 'LocalSettings.php';\r
+\r
+require 't/DatabaseMock.inc';\r
+\r
+$wgSearchType = 'MockSearch';\r
+\r
+require 'includes/Setup.php';\r
+\r
+\r
+class MockSearch extends SearchEngine {\r
+ public static $id;\r
+ public static $title;\r
+ public static $text;\r
+\r
+ public function __construct( $db ) {\r
+ }\r
+\r
+ public function update( $id, $title, $text ) {\r
+ self::$id = $id;\r
+ self::$title = $title;\r
+ self::$text = $text;\r
+ }\r
+}\r
+\r
+function update( $text, $title = 'Test', $id = 1 ) {\r
+ $u = new SearchUpdate( $id, $title, $text );\r
+ $u->doUpdate();\r
+ return array( MockSearch::$title, MockSearch::$text );\r
+}\r
+\r
+function updateText( $text ) {\r
+ list( $title, $resultText ) = update( $text );\r
+ $resultText = trim( $resultText ); // abstract from some implementation details\r
+ return $resultText;\r
+}\r
+\r
+is( updateText( '<div>TeSt</div>' ), 'test', 'HTML stripped, text lowercased' );\r
+\r
+is( updateText( <<<EOT\r
+<table style="color:red; font-size:100px">\r
+ <tr class="scary"><td><div>foo</div></td><tr>bar</td></tr>\r
+ <tr><td>boz</td><tr>quux</td></tr>\r
+</table>\r
+EOT\r
+), 'foo bar boz quux', 'Stripping HTML tables' );\r
+\r
+is( updateText( 'a > b' ), 'a b', 'Handle unclosed tags' );\r
+\r
+$text = str_pad( "foo <barbarbar \n", 10000, 'x' );\r
+ok( updateText( $text ) != '', 'Bug 18609' );
\ No newline at end of file