r22759 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22758‎ | r22759 | r22760 >
Date:14:39, 5 June 2007
Author:robchurch
Status:old
Tags:
Comment:
* (bug 9993) Force $wgShowExceptionDetails on during installation
* (bug 9980) Validate administrator username and password during installation
* Some dependencies initialised during installer (some extra includes, should be harmless, $wgContLang and $wgLang, which are re-initialised later in the script, and a stub $wgAuth)
* Re-enable error reporting
* Fix an undefined variable notice
* A few other minor bits and pieces
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/config/index.php (modified) (history)

Diff [purge]

Index: trunk/phase3/config/index.php
@@ -45,10 +45,17 @@
4646
4747 require_once( "includes/Defines.php" );
4848 require_once( "includes/DefaultSettings.php" );
 49+require_once( "includes/AutoLoader.php" );
4950 require_once( "includes/MagicWord.php" );
5051 require_once( "includes/Namespace.php" );
5152 require_once( "includes/ProfilerStub.php" );
 53+require_once( "includes/GlobalFunctions.php" );
 54+require_once( "includes/Hooks.php" );
5255
 56+# If we get an exception, the user needs to know
 57+# all the details
 58+$wgShowExceptionDetails = true;
 59+
5360 ## Databases we support:
5461
5562 $ourdb = array();
@@ -269,12 +276,11 @@
270277 $conf = new ConfigData;
271278
272279 install_version_checks();
 280+$self = 'Installer'; # Maintenance script name, to please Setup.php
273281
274282 print "<li>PHP " . phpversion() . " installed</li>\n";
275283
276 -## Temporarily turn off all errors as we try to discover installed databases
277 -$olderrnum = error_reporting(0);
278 -
 284+error_reporting( 0 );
279285 $phpdatabases = array();
280286 foreach (array_keys($ourdb) as $db) {
281287 $compname = $ourdb[$db]['compile'];
@@ -283,9 +289,8 @@
284290 $ourdb[$db]['havedriver'] = 1;
285291 }
286292 }
 293+error_reporting( E_ALL );
287294
288 -error_reporting($olderrornum);
289 -
290295 if (!$phpdatabases) {
291296 print "Could not find a suitable database driver!<ul>";
292297 foreach (array_keys($ourdb) AS $db) {
@@ -547,11 +552,11 @@
548553 $conf->RootUser = importPost( "RootUser", "root" );
549554 $conf->RootPW = importPost( "RootPW", "" );
550555 $useRoot = importCheck( 'useroot', false );
 556+ $conf->LanguageCode = importPost( "LanguageCode", "en" );
551557
552558 ## MySQL specific:
553559 $conf->DBprefix = importPost( "DBprefix" );
554560 $conf->setSchema( importPost( "DBschema", "mysql4" ) );
555 - $conf->LanguageCode = importPost( "LanguageCode", "en" );
556561
557562 ## Postgres specific:
558563 $conf->DBport = importPost( "DBport", "5432" );
@@ -580,12 +585,48 @@
581586 $errs["DBprefix"] = "Invalid table prefix";
582587 }
583588
584 -if( $conf->SysopPass == "" ) {
585 - $errs["SysopPass"] = "Must not be blank";
 589+error_reporting( E_ALL );
 590+
 591+/**
 592+ * Initialise $wgLang and $wgContLang to something so we can
 593+ * call case-folding methods. Per Brion, this is English for
 594+ * now, although we could be clever and initialise to the
 595+ * user-selected language.
 596+ */
 597+$wgContLang = Language::factory( 'en' );
 598+$wgLang = $wgContLang;
 599+
 600+/**
 601+ * We're messing about with users, so we need a stub
 602+ * authentication plugin...
 603+ */
 604+$wgAuth = new AuthPlugin();
 605+
 606+/**
 607+ * Validate the initial administrator account; username,
 608+ * password checks, etc.
 609+ */
 610+if( $conf->SysopName ) {
 611+ # Check that the user can be created
 612+ $u = User::newFromName( $conf->SysopName );
 613+ if( $u instanceof User ) {
 614+ # Various password checks
 615+ if( $conf->SysopPass != '' ) {
 616+ if( $conf->SysopPass == $conf->SysopPass2 ) {
 617+ if( !$u->isValidPassword( $conf->SysopPass ) ) {
 618+ $errs['SysopPass'] = "Bad password";
 619+ }
 620+ } else {
 621+ $errs['SysopPass2'] = "Passwords don't match";
 622+ }
 623+ } else {
 624+ $errs['SysopPass'] = "Cannot be blank";
 625+ }
 626+ unset( $u );
 627+ } else {
 628+ $errs['SysopName'] = "Bad username";
 629+ }
586630 }
587 -if( $conf->SysopPass != $conf->SysopPass2 ) {
588 - $errs["SysopPass2"] = "Passwords don't match!";
589 -}
590631
591632 $conf->License = importRequest( "License", "none" );
592633 if( $conf->License == "gfdl" ) {
@@ -1088,6 +1129,9 @@
10891130 An admin can lock/delete pages, block users from editing, and do other maintenance tasks.<br />
10901131 A new account will be added only when creating a new wiki database.
10911132 </p>
 1133+ <p class="config-desc">
 1134+ The password cannot be the same as the username.
 1135+ </p>
10921136
10931137 <div class="config-input">
10941138 <label class='column'>Shared memory caching:</label>
Index: trunk/phase3/RELEASE-NOTES
@@ -127,6 +127,8 @@
128128 configuration format, e.g. "5;/tmp"
129129 * Don't generate a diff link in the patrol log if the page doesn't exist
130130 * (bug 10067) Translations for former skins removed from message files
 131+* (bug 9993) Force $wgShowExceptionDetails on during installation
 132+* (bug 9980) Validate administrator username and password during installation
131133
132134 == MediaWiki API changes since 1.10 ==
133135

Follow-up revisions

RevisionCommit summaryAuthorDate
r22791Merged revisions 22747-22790 via svnmerge from...david09:21, 6 June 2007

Status & tagging log