r56027 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56026‎ | r56027 | r56028 >
Date:13:18, 8 September 2009
Author:werdna
Status:ok (Comments)
Tags:
Comment:
Pull wgDBuser and wgDBpassword if adminuser and adminpassword are undefined, fixes dumpBackup.php
Modified paths:
  • /trunk/phase3/maintenance/backup.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/backup.inc
@@ -234,8 +234,16 @@
235235
236236 function backupDb() {
237237 global $wgDBadminuser, $wgDBadminpassword;
 238+ global $wgDBuser, $wgDBpassword;
238239 global $wgDBname, $wgDebugDumpSql, $wgDBtype;
239240 $flags = ($wgDebugDumpSql ? DBO_DEBUG : 0) | DBO_DEFAULT; // god-damn hack
 241+
 242+ if ( !$wgDBadminuser ) {
 243+ $wgDBadminuser = $wgDBuser;
 244+ }
 245+ if ( !$wgDBadminpassword ) {
 246+ $wgDBadminpassword = $wgDBpassword;
 247+ }
240248
241249 $class = 'Database' . ucfirst($wgDBtype);
242250 $db = new $class( $this->backupServer(), $wgDBadminuser, $wgDBadminpassword, $wgDBname, false, $flags );

Comments

#Comment by Brion VIBBER (talk | contribs)   19:11, 8 September 2009

Would be good to make sure these vars are initialized to null or false or something in DefaultSettings.php, just for good measure.

#Comment by Werdna (talk | contribs)   19:14, 8 September 2009

Some codebase grepping indicates that there's quite a bit of code, including some in quite a number of extensions, which relies on !isset($wgDBadminuser) to check if it's been set.

#Comment by Werdna (talk | contribs)   19:20, 8 September 2009

Done, r56059.

Status & tagging log