Index: trunk/phase3/includes/installer/SqliteInstaller.php |
— | — | @@ -170,16 +170,6 @@ |
171 | 171 | return $status; |
172 | 172 | } |
173 | 173 | |
174 | | - public function doUpgrade() { |
175 | | - LBFactory::enableBackend(); |
176 | | - $db = wfGetDB( DB_MASTER ); |
177 | | - ob_start( array( $this, 'outputHandler' ) ); |
178 | | - $updater = DatabaseUpdater::newForDb( $this->db ); |
179 | | - $updater->doUpdates(); |
180 | | - ob_end_flush(); |
181 | | - return true; |
182 | | - } |
183 | | - |
184 | 174 | public function getLocalSettings() { |
185 | 175 | $dir = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgSQLiteDataDir' ) ); |
186 | 176 | return |
Index: trunk/phase3/includes/installer/DatabaseInstaller.php |
— | — | @@ -141,14 +141,30 @@ |
142 | 142 | * |
143 | 143 | * @return String |
144 | 144 | */ |
145 | | - public abstract function getLocalSettings(); |
| 145 | + public abstract function getLocalSettings(); |
146 | 146 | |
147 | 147 | /** |
148 | 148 | * Perform database upgrades |
149 | 149 | * |
150 | 150 | * @return Boolean |
151 | 151 | */ |
152 | | - public abstract function doUpgrade(); |
| 152 | + public function doUpgrade() { |
| 153 | + # Maintenance scripts like wfGetDB() |
| 154 | + LBFactory::enableBackend(); |
| 155 | + |
| 156 | + $ret = true; |
| 157 | + ob_start( array( __CLASS__, 'outputHandler' ) ); |
| 158 | + try { |
| 159 | + $up = DatabaseUpdater::newForDB( $this->db ); |
| 160 | + $up->execute(); |
| 161 | + } catch ( MWException $e ) { |
| 162 | + echo "\nAn error occured:\n"; |
| 163 | + echo $e->getText(); |
| 164 | + $ret = false; |
| 165 | + } |
| 166 | + ob_end_flush(); |
| 167 | + return $ret; |
| 168 | + } |
153 | 169 | |
154 | 170 | /** |
155 | 171 | * Allow DB installers a chance to make last-minute changes before installation |
Index: trunk/phase3/includes/installer/MysqlInstaller.php |
— | — | @@ -131,6 +131,8 @@ |
132 | 132 | } |
133 | 133 | |
134 | 134 | public function preUpgrade() { |
| 135 | + global $wgDBuser, $wgDBpassword; |
| 136 | + |
135 | 137 | $status = $this->getConnection(); |
136 | 138 | if ( !$status->isOK() ) { |
137 | 139 | $this->parent->showStatusError( $status ); |
— | — | @@ -178,35 +180,11 @@ |
179 | 181 | $this->parent->showMessage( 'config-mysql-egine-mismatch', $this->getVar( '_MysqlEngine' ), $existingEngine ); |
180 | 182 | $this->setVar( '_MysqlEngine', $existingEngine ); |
181 | 183 | } |
182 | | - } |
183 | 184 | |
184 | | - /** |
185 | | - * @todo FIXME: this code is just pure crap for compatibility between |
186 | | - * old and new code. |
187 | | - */ |
188 | | - public function doUpgrade() { |
189 | | - global $wgDBuser, $wgDBpassword; |
190 | | - |
191 | | - # Some maintenance scripts like wfGetDB() |
192 | | - LBFactory::enableBackend(); |
193 | 185 | # Normal user and password are selected after this step, so for now |
194 | 186 | # just copy these two |
195 | 187 | $wgDBuser = $this->getVar( '_InstallUser' ); |
196 | 188 | $wgDBpassword = $this->getVar( '_InstallPassword' ); |
197 | | - |
198 | | - $ret = true; |
199 | | - |
200 | | - ob_start( array( $this, 'outputHandler' ) ); |
201 | | - try { |
202 | | - $updater = DatabaseUpdater::newForDb( $this->db ); |
203 | | - $updater->doUpdates(); |
204 | | - } catch ( MWException $e ) { |
205 | | - echo "\nAn error occured:\n"; |
206 | | - echo $e->getText(); |
207 | | - $ret = false; |
208 | | - } |
209 | | - ob_end_flush(); |
210 | | - return $ret; |
211 | 189 | } |
212 | 190 | |
213 | 191 | /** |
Index: trunk/phase3/includes/installer/PostgresInstaller.php |
— | — | @@ -126,8 +126,12 @@ |
127 | 127 | \$wgDBts2schema = \"{$ts2}\";"; |
128 | 128 | } |
129 | 129 | |
130 | | - public function doUpgrade() { |
131 | | - // TODO |
132 | | - return false; |
| 130 | + public function preUpgrade() { |
| 131 | + global $wgDBuser, $wgDBpassword; |
| 132 | + |
| 133 | + # Normal user and password are selected after this step, so for now |
| 134 | + # just copy these two |
| 135 | + $wgDBuser = $this->getVar( '_InstallUser' ); |
| 136 | + $wgDBpassword = $this->getVar( '_InstallPassword' ); |
133 | 137 | } |
134 | 138 | } |