* @file
* @ingroup Deployment
*/
-
+
/**
* Class for setting up the MediaWiki database using SQLLite.
- *
+ *
* @ingroup Deployment
* @since 1.17
*/
class SqliteInstaller extends DatabaseInstaller {
-
+
protected $globalNames = array(
'wgDBname',
'wgSQLiteDataDir',
}
public function getConnectForm() {
- return $this->getTextBox( 'wgSQLiteDataDir', 'config-sqlite-dir' ) .
- $this->parent->getHelpBox( 'config-sqlite-dir-help' ) .
- $this->getTextBox( 'wgDBname', 'config-db-name' ) .
- $this->parent->getHelpBox( 'config-sqlite-name-help' );
+ return $this->getTextBox( 'wgSQLiteDataDir', 'config-sqlite-dir', array(), $this->parent->getHelpBox( 'config-sqlite-dir-help' ) ) .
+ $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-sqlite-name-help' ) );
}
public function submitConnectForm() {
return parent::needsUpgrade();
}
- public function getSettingsForm() {
- return false;
- }
-
- public function submitSettingsForm() {
- return Status::newGood();
- }
-
public function setupDatabase() {
$dir = $this->getVar( 'wgSQLiteDataDir' );
}
public function createTables() {
- global $IP;
- $status = $this->getConnection();
- if ( !$status->isOK() ) {
- return $status;
- }
- // Process common MySQL/SQLite table definitions
- $err = $this->db->sourceFile( "$IP/maintenance/tables.sql" );
- if ( $err !== true ) {
- //@todo or...?
- $this->db->reportQueryError( $err, 0, $sql, __FUNCTION__ );
- }
- return $this->setupSearchIndex();
+ $status = parent::createTables();
+ return $this->setupSearchIndex( $status );
}
- public function setupSearchIndex() {
+ public function setupSearchIndex( &$status ) {
global $IP;
- $status = Status::newGood();
-
$module = $this->db->getFulltextSearchModule();
$fts3tTable = $this->db->checkForEnabledSearch();
if ( $fts3tTable && !$module ) {
$status->warning( 'config-sqlite-fts3-downgrade' );
$this->db->sourceFile( "$IP/maintenance/sqlite/archives/searchindex-no-fts.sql" );
} elseif ( !$fts3tTable && $module == 'FTS3' ) {
- $status->warning( 'config-sqlite-fts3-add' );
$this->db->sourceFile( "$IP/maintenance/sqlite/archives/searchindex-fts3.sql" );
}
return $status;
}
- public function doUpgrade() {
- global $wgDatabase;
- LBFactory::enableBackend();
- $wgDatabase = wfGetDB( DB_MASTER );
- ob_start( array( 'SqliteInstaller', 'outputHandler' ) );
- do_all_updates( false, true );
- ob_end_flush();
- return true;
- }
-
- public static function outputHandler( $string ) {
- return htmlspecialchars( $string );
- }
-
public function getLocalSettings() {
$dir = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgSQLiteDataDir' ) );
return
"# SQLite-specific settings
\$wgSQLiteDataDir = \"{$dir}\";";
}
-
-}
\ No newline at end of file
+}