}
}
+ /**
+ * Return a path to the DBMS-specific schema, otherwise default to tables.sql
+ */
+ public function getSchema() {
+ global $IP;
+ if ( file_exists( "$IP/maintenance/" . $this->getType() . "/tables.sql" ) ) {
+ return "$IP/maintenance/" . $this->getType() . "/tables.sql";
+ } else {
+ return "$IP/maintenance/tables.sql";
+ }
+ }
+
#------------------------------------------------------------------------------
# Other functions
#------------------------------------------------------------------------------
*
* @return Status
*/
- public abstract function createTables();
+ public function createTables() {
+ $status = $this->getConnection();
+ if ( !$status->isOK() ) {
+ return $status;
+ }
+ $this->db->selectDB( $this->getVar( 'wgDBname' ) );
+
+ if( $this->db->tableExists( 'user' ) ) {
+ $status->warning( 'config-install-tables-exist' );
+ return $status;
+ }
+
+ $error = $this->db->sourceFile( $this->db->getSchema() );
+ if( $error !== true ) {
+ $this->db->reportQueryError( $error, 0, $sql, __METHOD__ );
+ $status->fatal( 'config-install-tables-failed', $error );
+ }
+ return $status;
+ }
/**
* Get the DBMS-specific options for LocalSettings.php generation.
return $status;
}
- public function createTables() {
- global $IP;
- $status = $this->getConnection();
- if ( !$status->isOK() ) {
- return $status;
- }
- $this->db->selectDB( $this->getVar( 'wgDBname' ) );
-
- if( $this->db->tableExists( 'user' ) ) {
- $status->warning( 'config-install-tables-exist' );
- return $status;
- }
-
- $error = $this->db->sourceFile( "$IP/maintenance/tables.sql" );
- if( $error !== true ) {
- $status->fatal( 'config-install-tables-failed', $error );
- }
- return $status;
- }
-
public function getTableOptions() {
return array( 'engine' => $this->getVar( '_MysqlEngine' ),
'default charset' => $this->getVar( '_MysqlCharset' ) );
// TODO
}
- public function createTables() {
- // TODO
- }
-
public function getLocalSettings() {
$prefix = $this->getVar( 'wgDBprefix' );
return
function setupDatabase() {
}
- function createTables() {
- $status = $this->getConnection();
- if ( !$status->isOK() ) {
- return $status;
- }
- $this->db->selectDB( $this->getVar( 'wgDBname' ) );
-
- global $IP;
- $err = $this->db->sourceFile( "$IP/maintenance/postgres/tables.sql" );
- if ( $err !== true ) {
- //@todo or...?
- $this->db->reportQueryError( $err, 0, $sql, __FUNCTION__ );
- }
- return Status::newGood();
- }
-
function getLocalSettings() {
$port = $this->getVar( 'wgDBport' );
$schema = $this->getVar( 'wgDBmwschema' );
}
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 ) {