It was caused by a weird bug in SQLite: virtual table using a non-existent module still gets created somehow, and it is completely undeletable.
* Returns version of currently supported SQLite fulltext search module or false if none present.
* @return String
*/
- function getFulltextSearchModule() {
+ static function getFulltextSearchModule() {
static $cachedResult = null;
if ( $cachedResult !== null ) {
return $cachedResult;
}
$cachedResult = false;
$table = 'dummy_search_test';
- $this->query( "DROP TABLE IF EXISTS $table", __METHOD__ );
+
+ $db = new DatabaseSqliteStandalone( ':memory:' );
- if ( $this->query( "CREATE VIRTUAL TABLE $table USING FTS3(dummy_field)", __METHOD__, true ) ) {
- $this->query( "DROP TABLE IF EXISTS $table", __METHOD__ );
+ if ( $db->query( "CREATE VIRTUAL TABLE $table USING FTS3(dummy_field)", __METHOD__, true ) ) {
$cachedResult = 'FTS3';
}
+ $db->close();
return $cachedResult;
}
* @return string User-friendly database information
*/
public function getServerInfo() {
- return wfMsg( $this->getFulltextSearchModule() ? 'sqlite-has-fts' : 'sqlite-no-fts', $this->getServerVersion() );
+ return wfMsg( self::getFulltextSearchModule() ? 'sqlite-has-fts' : 'sqlite-no-fts', $this->getServerVersion() );
}
/**
// Check for FTS3 full-text search module
$sqlite = $this->getDBInstaller( 'sqlite' );
if ( $sqlite->isCompiled() ) {
- $db = new DatabaseSqliteStandalone( ':memory:' );
- if( $db->getFulltextSearchModule() != 'FTS3' ) {
+ if( DatabaseSqlite::getFulltextSearchModule() != 'FTS3' ) {
$this->showMessage( 'config-no-fts3' );
}
}
public function setupSearchIndex( &$status ) {
global $IP;
- $module = $this->db->getFulltextSearchModule();
+ $module = DatabaseSqlite::getFulltextSearchModule();
$fts3tTable = $this->db->checkForEnabledSearch();
if ( $fts3tTable && !$module ) {
$status->warning( 'config-sqlite-fts3-downgrade' );
}
protected function sqliteSetupSearchindex() {
- $module = $this->db->getFulltextSearchModule();
+ $module = DatabaseSqlite::getFulltextSearchModule();
$fts3tTable = $this->updateRowExists( 'fts3' );
if ( $fts3tTable && !$module ) {
$this->output( '...PHP is missing FTS3 support, downgrading tables...' );
$this->db = wfGetDB( DB_MASTER );
if ( $this->db->getType() == 'sqlite' ) {
- if ( !$this->db->getFulltextSearchModule() ) {
- $this->error( "Your version of SQLite module for PHP doesn't support full-text search (FTS3).\n" );
+ if ( !DatabaseSqlite::getFulltextSearchModule() ) {
+ $this->error( "Your version of SQLite module for PHP doesn't support full-text search (FTS3).\n", true );
}
if ( !$this->db->checkForEnabledSearch() ) {
- $this->error( "Your database schema is not configured for full-text search support. Run update.php.\n" );
+ $this->error( "Your database schema is not configured for full-text search support. Run update.php.\n", true );
}
}