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