3 * Oracle-specific installer.
10 * Class for setting up the MediaWiki database using Oracle.
15 class OracleInstaller
extends DatabaseInstaller
{
17 protected $globalNames = array(
25 protected $internalDefaults = array(
26 '_InstallUser' => 'sys',
27 '_InstallPassword' => '',
30 public function getName() {
34 public function isCompiled() {
35 return self
::checkExtension( 'oci8' );
38 public function getConnectForm() {
40 Xml
::openElement( 'fieldset' ) .
41 Xml
::element( 'legend', array(), wfMsg( 'config-db-wiki-settings' ) ) .
42 $this->getTextBox( 'wgDBname', 'config-db-name' ) .
43 $this->parent
->getHelpBox( 'config-db-name-help' ) .
44 $this->getTextBox( 'wgDBprefix', 'config-db-prefix' ) .
45 $this->parent
->getHelpBox( 'config-db-prefix-help' ) .
46 Xml
::closeElement( 'fieldset' ) .
47 $this->getInstallUserBox();
50 public function submitConnectForm() {
51 // Get variables from the request
52 $newValues = $this->setVarsFromRequest( array( 'wgDBname', 'wgDBprefix' ) );
55 $status = Status
::newGood();
56 if ( !strlen( $newValues['wgDBname'] ) ) {
57 $status->fatal( 'config-missing-db-name' );
58 } elseif ( !preg_match( '/^[a-zA-Z0-9_]+$/', $newValues['wgDBname'] ) ) {
59 $status->fatal( 'config-invalid-db-name', $newValues['wgDBname'] );
61 if ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBprefix'] ) ) {
62 $status->fatal( 'config-invalid-schema', $newValues['wgDBprefix'] );
66 if ( $status->isOK() ) {
67 $status->merge( $this->submitInstallUserBox() );
69 if ( !$status->isOK() ) {
74 if ( $status->isOK() ) {
75 $status->merge( $this->attemptConnection() );
77 if ( !$status->isOK() ) {
83 $version = $this->conn->getServerVersion();
84 if ( version_compare( $version, $this->minimumVersion ) < 0 ) {
85 return Status::newFatal( 'config-postgres-old', $this->minimumVersion, $version );
91 public function getConnection() {
92 $status = Status
::newGood();
94 $this->db
= new DatabaseOracle(
95 $this->getVar( 'wgDBserver' ),
96 $this->getVar( '_InstallUser' ),
97 $this->getVar( '_InstallPassword' ),
101 $this->getVar( 'wgDBprefix' )
103 $status->value
= $this->db
;
104 } catch ( DBConnectionError
$e ) {
105 $status->fatal( 'config-connection-error', $e->getMessage() );
110 public function setupDatabase() {
114 public function getLocalSettings() {
115 $prefix = $this->getVar( 'wgDBprefix' );
117 "# Oracle specific settings
118 \$wgDBprefix = \"{$prefix}\";";
121 public function doUpgrade() {