Merge new-installer branch to trunk
[lhc/web/wiklou.git] / includes / installer / OracleInstaller.php
1 <?php
2
3 class OracleInstaller extends InstallerDBType {
4
5 protected $globalNames = array(
6 'wgDBport',
7 'wgDBname',
8 'wgDBuser',
9 'wgDBpassword',
10 'wgDBprefix',
11 );
12
13 protected $internalDefaults = array(
14 '_InstallUser' => 'sys',
15 '_InstallPassword' => '',
16 );
17
18 function getName() {
19 return 'oracle';
20 }
21
22 function isCompiled() {
23 return $this->checkExtension( 'oci8' );
24 }
25
26 function getConnectForm() {
27 return
28 Xml::openElement( 'fieldset' ) .
29 Xml::element( 'legend', array(), wfMsg( 'config-db-wiki-settings' ) ) .
30 $this->getTextBox( 'wgDBname', 'config-db-name' ) .
31 $this->parent->getHelpBox( 'config-db-name-help' ) .
32 $this->getTextBox( 'wgDBprefix', 'config-db-prefix' ) .
33 $this->parent->getHelpBox( 'config-db-prefix-help' ) .
34 Xml::closeElement( 'fieldset' ) .
35 $this->getInstallUserBox();
36 }
37
38 function submitConnectForm() {
39 // Get variables from the request
40 $newValues = $this->setVarsFromRequest( array( 'wgDBname', 'wgDBprefix' ) );
41
42 // Validate them
43 $status = Status::newGood();
44 if ( !strlen( $newValues['wgDBname'] ) ) {
45 $status->fatal( 'config-missing-db-name' );
46 } elseif ( !preg_match( '/^[a-zA-Z0-9_]+$/', $newValues['wgDBname'] ) ) {
47 $status->fatal( 'config-invalid-db-name', $newValues['wgDBname'] );
48 }
49 if ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBprefix'] ) ) {
50 $status->fatal( 'config-invalid-schema', $newValues['wgDBprefix'] );
51 }
52
53 // Submit user box
54 if ( $status->isOK() ) {
55 $status->merge( $this->submitInstallUserBox() );
56 }
57 if ( !$status->isOK() ) {
58 return $status;
59 }
60
61 // Try to connect
62 if ( $status->isOK() ) {
63 $status->merge( $this->attemptConnection() );
64 }
65 if ( !$status->isOK() ) {
66 return $status;
67 }
68
69 // Check version
70 /*
71 $version = $this->conn->getServerVersion();
72 if ( version_compare( $version, $this->minimumVersion ) < 0 ) {
73 return Status::newFatal( 'config-postgres-old', $this->minimumVersion, $version );
74 }
75 */
76 return $status;
77 }
78
79
80 function getSettingsForm() {}
81
82 function submitSettingsForm() {}
83
84 function getConnection() {}
85
86 function setupDatabase() {}
87
88 function createTables() {}
89
90 function getLocalSettings() {
91 $prefix = $this->getVar( 'wgDBprefix' );
92 return
93 "# Oracle specific settings
94 \$wgDBprefix = \"{$prefix}\";";
95 }
96 }