r75366 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75365‎ | r75366 | r75367 >
Date:16:49, 25 October 2010
Author:freakolowsky
Status:ok (Comments)
Tags:
Comment:
* DatabaseOracle - throw connection exception instead of debug+false
* DatabaseOracle - fixed $wgContLang local usage in update
* Installer - added Main Page insertion as a new installation step (fixes bug 22308)
Modified paths:
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/installer/CoreInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/DatabaseInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.i18n.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/OracleInstaller.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -268,10 +268,7 @@
269269 }
270270
271271 if ( !$this->mConn ) {
272 - wfDebug( "DB connection error\n" );
273 - wfDebug( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" );
274 - wfDebug( $this->lastError() . "\n" );
275 - return false;
 272+ throw new DBConnectionError( $this, $this->lastError() );
276273 }
277274
278275 $this->mOpened = true;
@@ -1198,6 +1195,8 @@
11991196 }
12001197
12011198 function update( $table, $values, $conds, $fname = 'DatabaseOracle::update', $options = array() ) {
 1199+ global $wgContLang;
 1200+
12021201 $table = $this->tableName( $table );
12031202 $opts = $this->makeUpdateOptions( $options );
12041203 $sql = "UPDATE $opts $table SET ";
Index: trunk/phase3/includes/installer/Installer.php
@@ -357,6 +357,8 @@
358358 if( $status->isOK() ) {
359359 LBFactory::enableBackend();
360360 }
 361+
 362+ return $status;
361363 }
362364
363365 /**
@@ -371,6 +373,17 @@
372374 }
373375
374376 /**
 377+ * TODO: document
 378+ *
 379+ * @param $installer DatabaseInstaller
 380+ *
 381+ * @return Status
 382+ */
 383+ public function installMainpage( DatabaseInstaller &$installer ) {
 384+ return $installer->createMainpage();
 385+ }
 386+
 387+ /**
375388 * Exports all wg* variables stored by the installer into global scope.
376389 */
377390 public function exportVars() {
Index: trunk/phase3/includes/installer/CoreInstaller.php
@@ -96,6 +96,7 @@
9797 'interwiki',
9898 'secretkey',
9999 'sysop',
 100+ 'mainpage',
100101 );
101102
102103 /**
Index: trunk/phase3/includes/installer/Installer.i18n.php
@@ -481,6 +481,8 @@
482482 'config-insecure-secretkey' => "'''Warning:''' Unable to create secure <code>\$wgSecretKey</code>.
483483 Consider changing it manually.",
484484 'config-install-sysop' => 'Creating administrator user account',
 485+ 'config-install-mainpage' => 'Creating main page with default content',
 486+ 'config-install-mainpage-failed' => 'Could not insert main page.',
485487 'config-install-done' => "'''Congratulations!'''
486488 You have successfully installed MediaWiki.
487489
Index: trunk/phase3/includes/installer/DatabaseInstaller.php
@@ -137,6 +137,27 @@
138138 }
139139
140140 /**
 141+ * Insert Main Page with default content.
 142+ *
 143+ * @return Status
 144+ */
 145+ public function createMainpage() {
 146+ $status = Status::newGood();
 147+ try {
 148+ $titleobj = Title::newFromText( wfMsgNoDB( "mainpage" ) );
 149+ $article = new Article( $titleobj );
 150+ $article->doEdit( wfMsg( 'mainpagetext' ) . "\n\n" . wfMsgNoTrans( 'mainpagedocfooter' ),
 151+ '',
 152+ EDIT_NEW );
 153+ } catch (MWException $e) {
 154+ //using raw, because $wgShowExceptionDetails can not be set yet
 155+ $status->fatal( 'config-install-mainpage-failed', $e->getMessage() );
 156+ }
 157+
 158+ return $status;
 159+ }
 160+
 161+ /**
141162 * Get the DBMS-specific options for LocalSettings.php generation.
142163 *
143164 * @return String
Index: trunk/phase3/includes/installer/OracleInstaller.php
@@ -120,7 +120,6 @@
121121 $this->getVar( '_InstallUser' ),
122122 $this->getVar( '_InstallPassword' ),
123123 $this->getVar( 'wgDBname' ),
124 - false,
125124 DBO_SYSDBA,
126125 $this->getVar( 'wgDBprefix' )
127126 );
@@ -130,7 +129,6 @@
131130 $this->getVar( 'wgDBuser' ),
132131 $this->getVar( 'wgDBpassword' ),
133132 $this->getVar( 'wgDBname' ),
134 - false,
135133 0,
136134 $this->getVar( 'wgDBprefix' )
137135 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r75371* moved installMainpage to CoreInstaller as requested in r75366freakolowsky18:57, 25 October 2010
r75654(bug 22308) Search should find text in default main page immediately after se...demon17:26, 29 October 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75354Revert mainpage part of r75347. Should go in its own method, with messages, p...demon14:41, 25 October 2010

Comments

#Comment by 😂 (talk | contribs)   16:52, 25 October 2010

installMainpage() should be in CoreInstaller. Implementation probably doesn't need to be in DatabaseInstaller, just keep it in installMainpage()

Status & tagging log