Index: branches/new-installer/phase3/maintenance/language/messages.inc |
— | — | @@ -3361,8 +3361,10 @@ |
3362 | 3362 | 'config-install-tables', |
3363 | 3363 | 'config-install-interwiki-sql', |
3364 | 3364 | 'config-install-secretkey', |
| 3365 | + 'config-insecure-secretkey', |
3365 | 3366 | 'config-install-sysop', |
3366 | 3367 | 'config-install-localsettings', |
| 3368 | + 'config-install-localsettings-unwritable', |
3367 | 3369 | 'config-install-done', |
3368 | 3370 | 'config-install-done-moved', |
3369 | 3371 | ), |
Index: branches/new-installer/phase3/includes/installer/LocalSettings.php |
— | — | @@ -4,12 +4,14 @@ |
5 | 5 | private $extensions, $values = array(); |
6 | 6 | private $configPath, $dbSettings = ''; |
7 | 7 | private $safeMode = false; |
| 8 | + private $installer; |
8 | 9 | |
9 | 10 | /** |
10 | 11 | * Construtor. |
11 | 12 | * @param $installer Installer subclass |
12 | 13 | */ |
13 | 14 | public function __construct( Installer $installer ) { |
| 15 | + $this->installer = $installer; |
14 | 16 | $this->configPath = $installer->getVar( 'IP' ) . '/config'; |
15 | 17 | $this->extensions = $installer->getVar( '_Extensions' ); |
16 | 18 | $db = $installer->getDBInstaller( $installer->getVar( 'wgDBtype' ) ); |
— | — | @@ -65,7 +67,16 @@ |
66 | 68 | $localSettings .= "require( 'extensions/$ext/$ext.php' );\n"; |
67 | 69 | } |
68 | 70 | } |
69 | | - return file_put_contents( $this->configPath . '/LocalSettings.php', $localSettings ); |
| 71 | + wfSuppressWarnings(); |
| 72 | + $ret = file_put_contents( $this->configPath . '/LocalSettings.php', $localSettings ); |
| 73 | + wfRestoreWarnings(); |
| 74 | + if ( !$ret ) { |
| 75 | + $warn = wfMsg( 'config-install-localsettings-unwritable' ) . ' |
| 76 | +<textarea name="LocalSettings" id="LocalSettings" cols="80" rows="25" readonly="readonly">' |
| 77 | + . htmlspecialchars( $localSettings ) . '</textarea>'; |
| 78 | + $this->installer->output->addWarning( $warn ); |
| 79 | + } |
| 80 | + return $ret; |
70 | 81 | } |
71 | 82 | |
72 | 83 | private function buildMemcachedServerList() { |
Index: branches/new-installer/phase3/includes/installer/WebInstaller.php |
— | — | @@ -765,6 +765,7 @@ |
766 | 766 | } |
767 | 767 | |
768 | 768 | function endForm( $continue = 'continue' ) { |
| 769 | + $this->parent->output->outputWarnings(); |
769 | 770 | $s = "<div class=\"config-submit\">\n"; |
770 | 771 | $id = $this->getId(); |
771 | 772 | if ( $id === false ) { |
Index: branches/new-installer/phase3/includes/installer/WebInstallerOutput.php |
— | — | @@ -11,6 +11,7 @@ |
12 | 12 | class WebInstallerOutput { |
13 | 13 | var $parent; |
14 | 14 | var $contents = ''; |
| 15 | + var $warnings = ''; |
15 | 16 | var $headerDone = false; |
16 | 17 | var $redirectTarget; |
17 | 18 | var $debug = true; |
— | — | @@ -33,6 +34,16 @@ |
34 | 35 | $this->contents .= $html; |
35 | 36 | } |
36 | 37 | |
| 38 | + function addWarning( $msg ) { |
| 39 | + $this->warnings .= "<p>$msg</p>\n"; |
| 40 | + } |
| 41 | + |
| 42 | + function addWarningMsg( $msg /*, ... */ ) { |
| 43 | + $params = func_get_args(); |
| 44 | + array_shift( $params ); |
| 45 | + $this->addWarning( wfMsg( $msg, $params ) ); |
| 46 | + } |
| 47 | + |
37 | 48 | function redirect( $url ) { |
38 | 49 | if ( $this->headerDone ) { |
39 | 50 | throw new MWException( __METHOD__ . ' called after sending headers' ); |
— | — | @@ -122,6 +133,8 @@ |
123 | 134 | } |
124 | 135 | |
125 | 136 | function outputFooter() { |
| 137 | + $this->outputWarnings(); |
| 138 | + |
126 | 139 | if ( $this->useShortHeader ) { |
127 | 140 | ?> |
128 | 141 | </body></html> |
— | — | @@ -170,4 +183,9 @@ |
171 | 184 | <body style="background-image: none"> |
172 | 185 | <?php |
173 | 186 | } |
| 187 | + |
| 188 | + function outputWarnings() { |
| 189 | + $this->addHTML( $this->warnings ); |
| 190 | + $this->warnings = ''; |
| 191 | + } |
174 | 192 | } |
Index: branches/new-installer/phase3/includes/installer/Installer.php |
— | — | @@ -806,16 +806,15 @@ |
807 | 807 | if ( $file ) { |
808 | 808 | $secretKey = bin2hex( fread( $file, 32 ) ); |
809 | 809 | fclose( $file ); |
810 | | - $ret = true; |
811 | 810 | } else { |
812 | 811 | $secretKey = ""; |
813 | 812 | for ( $i=0; $i<8; $i++ ) { |
814 | 813 | $secretKey .= dechex(mt_rand(0, 0x7fffffff)); |
815 | 814 | } |
816 | | - $ret = false; |
| 815 | + $this->output->addWarningMsg( 'config-insecure-secretkey' ); |
817 | 816 | } |
818 | 817 | $this->setVar( 'wgSecretKey', $secretKey ); |
819 | | - return $ret; |
| 818 | + return true; |
820 | 819 | } |
821 | 820 | |
822 | 821 | public function installSysop() { |
Index: branches/new-installer/phase3/languages/messages/MessagesEn.php |
— | — | @@ -4586,8 +4586,10 @@ |
4587 | 4587 | 'config-install-tables' => 'Creating tables', |
4588 | 4588 | 'config-install-interwiki-sql' => 'Could not find file interwiki.sql', |
4589 | 4589 | 'config-install-secretkey' => 'Generating secret key', |
| 4590 | +'config-insecure-secretkey' => 'Warning: Unable to create secure $wgSecretKey. Consider changing it manually.', |
4590 | 4591 | 'config-install-sysop' => 'Creating administrator user account', |
4591 | | -'config-install-localsettings' => 'Writing LocalSettings.php', |
| 4592 | +'config-install-localsettings' => 'Creating LocalSettings.php', |
| 4593 | +'config-install-localsettings-unwritable' => 'Warning: could not write LocalSettings.php. Please create it yourself, using the following text:', |
4592 | 4594 | 'config-install-done' => "'''Congratulations''', you have successfully installed MediaWiki. |
4593 | 4595 | |
4594 | 4596 | You will need to move it from <tt>./config/LocalSettings.php</tt> to <tt>./LocalSettings.php</tt> in order |