Index: trunk/phase3/maintenance/rebuildtextindex.php |
— | — | @@ -50,11 +50,11 @@ |
51 | 51 | |
52 | 52 | $this->db = wfGetDB( DB_MASTER ); |
53 | 53 | if ( $this->db->getType() == 'sqlite' ) { |
54 | | - if ( !$this->db->getFulltextSearchModule() ) { |
55 | | - $this->error( "Your version of SQLite module for PHP doesn't support full-text search (FTS3).\n" ); |
| 54 | + if ( !DatabaseSqlite::getFulltextSearchModule() ) { |
| 55 | + $this->error( "Your version of SQLite module for PHP doesn't support full-text search (FTS3).\n", true ); |
56 | 56 | } |
57 | 57 | if ( !$this->db->checkForEnabledSearch() ) { |
58 | | - $this->error( "Your database schema is not configured for full-text search support. Run update.php.\n" ); |
| 58 | + $this->error( "Your database schema is not configured for full-text search support. Run update.php.\n", true ); |
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
Index: trunk/phase3/includes/db/DatabaseSqlite.php |
— | — | @@ -130,19 +130,20 @@ |
131 | 131 | * Returns version of currently supported SQLite fulltext search module or false if none present. |
132 | 132 | * @return String |
133 | 133 | */ |
134 | | - function getFulltextSearchModule() { |
| 134 | + static function getFulltextSearchModule() { |
135 | 135 | static $cachedResult = null; |
136 | 136 | if ( $cachedResult !== null ) { |
137 | 137 | return $cachedResult; |
138 | 138 | } |
139 | 139 | $cachedResult = false; |
140 | 140 | $table = 'dummy_search_test'; |
141 | | - $this->query( "DROP TABLE IF EXISTS $table", __METHOD__ ); |
| 141 | + |
| 142 | + $db = new DatabaseSqliteStandalone( ':memory:' ); |
142 | 143 | |
143 | | - if ( $this->query( "CREATE VIRTUAL TABLE $table USING FTS3(dummy_field)", __METHOD__, true ) ) { |
144 | | - $this->query( "DROP TABLE IF EXISTS $table", __METHOD__ ); |
| 144 | + if ( $db->query( "CREATE VIRTUAL TABLE $table USING FTS3(dummy_field)", __METHOD__, true ) ) { |
145 | 145 | $cachedResult = 'FTS3'; |
146 | 146 | } |
| 147 | + $db->close(); |
147 | 148 | return $cachedResult; |
148 | 149 | } |
149 | 150 | |
— | — | @@ -460,7 +461,7 @@ |
461 | 462 | * @return string User-friendly database information |
462 | 463 | */ |
463 | 464 | public function getServerInfo() { |
464 | | - return wfMsg( $this->getFulltextSearchModule() ? 'sqlite-has-fts' : 'sqlite-no-fts', $this->getServerVersion() ); |
| 465 | + return wfMsg( self::getFulltextSearchModule() ? 'sqlite-has-fts' : 'sqlite-no-fts', $this->getServerVersion() ); |
465 | 466 | } |
466 | 467 | |
467 | 468 | /** |
Index: trunk/phase3/includes/installer/Installer.php |
— | — | @@ -625,8 +625,7 @@ |
626 | 626 | // Check for FTS3 full-text search module |
627 | 627 | $sqlite = $this->getDBInstaller( 'sqlite' ); |
628 | 628 | if ( $sqlite->isCompiled() ) { |
629 | | - $db = new DatabaseSqliteStandalone( ':memory:' ); |
630 | | - if( $db->getFulltextSearchModule() != 'FTS3' ) { |
| 629 | + if( DatabaseSqlite::getFulltextSearchModule() != 'FTS3' ) { |
631 | 630 | $this->showMessage( 'config-no-fts3' ); |
632 | 631 | } |
633 | 632 | } |
Index: trunk/phase3/includes/installer/SqliteInstaller.php |
— | — | @@ -170,7 +170,7 @@ |
171 | 171 | public function setupSearchIndex( &$status ) { |
172 | 172 | global $IP; |
173 | 173 | |
174 | | - $module = $this->db->getFulltextSearchModule(); |
| 174 | + $module = DatabaseSqlite::getFulltextSearchModule(); |
175 | 175 | $fts3tTable = $this->db->checkForEnabledSearch(); |
176 | 176 | if ( $fts3tTable && !$module ) { |
177 | 177 | $status->warning( 'config-sqlite-fts3-downgrade' ); |
Index: trunk/phase3/includes/installer/SqliteUpdater.php |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | } |
69 | 69 | |
70 | 70 | protected function sqliteSetupSearchindex() { |
71 | | - $module = $this->db->getFulltextSearchModule(); |
| 71 | + $module = DatabaseSqlite::getFulltextSearchModule(); |
72 | 72 | $fts3tTable = $this->updateRowExists( 'fts3' ); |
73 | 73 | if ( $fts3tTable && !$module ) { |
74 | 74 | $this->output( '...PHP is missing FTS3 support, downgrading tables...' ); |