Index: branches/REL1_17/phase3/maintenance/install.php |
— | — | @@ -50,7 +50,6 @@ |
51 | 51 | $this->addOption( 'dbpass', 'The pasword for the DB user for normal operations', false, true ); |
52 | 52 | $this->addOption( 'confpath', "Path to write LocalSettings.php to, default $IP", false, true ); |
53 | 53 | /* $this->addOption( 'dbschema', 'The schema for the MediaWiki DB in pg (mediawiki)', false, true ); */ |
54 | | - /* $this->addOption( 'dbtsearch2schema', 'The schema for the tsearch2 DB in pg (public)', false, true ); */ |
55 | 54 | /* $this->addOption( 'namespace', 'The project namespace (same as the name)', false, true ); */ |
56 | 55 | $this->addOption( 'env-checks', "Run environment checks only, don't change anything" ); |
57 | 56 | } |
— | — | @@ -73,6 +72,13 @@ |
74 | 73 | return; |
75 | 74 | } |
76 | 75 | } else { |
| 76 | + $status = $installer->doEnvironmentChecks(); |
| 77 | + if( $status->isGood() ) { |
| 78 | + $installer->showMessage( 'config-env-good' ); |
| 79 | + } else { |
| 80 | + $installer->showStatusMessage( $status ); |
| 81 | + return; |
| 82 | + } |
77 | 83 | $installer->execute(); |
78 | 84 | $installer->writeConfigurationFile( $this->getOption( 'confpath', $IP ) ); |
79 | 85 | } |
Property changes on: branches/REL1_17/phase3/maintenance/install.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
80 | 86 | Merged /branches/sqlite/maintenance/install.php:r58211-58321 |
81 | 87 | Merged /trunk/phase3/maintenance/install.php:r79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,81519,84756 |
82 | 88 | Merged /branches/new-installer/phase3/maintenance/install.php:r43664-66004 |
83 | 89 | Merged /branches/REL1_15/phase3/maintenance/install.php:r51646 |
Property changes on: branches/REL1_17/phase3/includes/installer/MysqlUpdater.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
84 | 90 | Merged /trunk/phase3/includes/installer/MysqlUpdater.php:r84875,84881-84882,84970,84976 |
Index: branches/REL1_17/phase3/includes/installer/WebInstaller.php |
— | — | @@ -177,6 +177,7 @@ |
178 | 178 | if ( $this->request->getVal( 'SubmitCC' ) ) { |
179 | 179 | $page = $this->getPageByName( 'Options' ); |
180 | 180 | $this->output->useShortHeader(); |
| 181 | + $this->output->allowFrames(); |
181 | 182 | $page->submitCC(); |
182 | 183 | return $this->finish(); |
183 | 184 | } |
— | — | @@ -184,6 +185,7 @@ |
185 | 186 | if ( $this->request->getVal( 'ShowCC' ) ) { |
186 | 187 | $page = $this->getPageByName( 'Options' ); |
187 | 188 | $this->output->useShortHeader(); |
| 189 | + $this->output->allowFrames(); |
188 | 190 | $this->output->addHTML( $page->getCCDoneBox() ); |
189 | 191 | return $this->finish(); |
190 | 192 | } |
— | — | @@ -323,7 +325,13 @@ |
324 | 326 | public function getFingerprint() { |
325 | 327 | // Get the base URL of the installation |
326 | 328 | $url = $this->request->getFullRequestURL(); |
| 329 | + if ( preg_match( '!^(.*\?)!', $url, $m) ) { |
| 330 | + // Trim query string |
| 331 | + $url = $m[1]; |
| 332 | + } |
327 | 333 | if ( preg_match( '!^(.*)/[^/]*/[^/]*$!', $url, $m ) ) { |
| 334 | + // This... seems to try to get the base path from |
| 335 | + // the /mw-config/index.php. Kinda scary though? |
328 | 336 | $url = $m[1]; |
329 | 337 | } |
330 | 338 | return md5( serialize( array( |
Index: branches/REL1_17/phase3/includes/installer/Installer.php |
— | — | @@ -1196,7 +1196,7 @@ |
1197 | 1197 | * but we're not opening that can of worms |
1198 | 1198 | * @see https://bugzilla.wikimedia.org/show_bug.cgi?id=26857 |
1199 | 1199 | */ |
1200 | | - global $wgHooks, $wgAutoloadClasses; |
| 1200 | + global $wgAutoloadClasses; |
1201 | 1201 | require( "$IP/includes/DefaultSettings.php" ); |
1202 | 1202 | |
1203 | 1203 | foreach( $exts as $e ) { |
— | — | @@ -1208,8 +1208,7 @@ |
1209 | 1209 | |
1210 | 1210 | // Unset everyone else's hooks. Lord knows what someone might be doing |
1211 | 1211 | // in ParserFirstCallInit (see bug 27171) |
1212 | | - unset( $wgHooks ); |
1213 | | - $wgHooks = array( 'LoadExtensionSchemaUpdates' => $hooksWeWant ); |
| 1212 | + $GLOBALS['wgHooks'] = array( 'LoadExtensionSchemaUpdates' => $hooksWeWant ); |
1214 | 1213 | |
1215 | 1214 | return Status::newGood(); |
1216 | 1215 | } |
— | — | @@ -1232,8 +1231,7 @@ |
1233 | 1232 | array( 'name' => 'tables', 'callback' => array( $installer, 'createTables' ) ), |
1234 | 1233 | array( 'name' => 'interwiki', 'callback' => array( $installer, 'populateInterwikiTable' ) ), |
1235 | 1234 | array( 'name' => 'stats', 'callback' => array( $this, 'populateSiteStats' ) ), |
1236 | | - array( 'name' => 'secretkey', 'callback' => array( $this, 'generateSecretKey' ) ), |
1237 | | - array( 'name' => 'upgradekey', 'callback' => array( $this, 'generateUpgradeKey' ) ), |
| 1235 | + array( 'name' => 'keys', 'callback' => array( $this, 'generateKeys' ) ), |
1238 | 1236 | array( 'name' => 'sysop', 'callback' => array( $this, 'createSysop' ) ), |
1239 | 1237 | array( 'name' => 'mainpage', 'callback' => array( $this, 'createMainpage' ) ), |
1240 | 1238 | ); |
— | — | @@ -1313,59 +1311,55 @@ |
1314 | 1312 | * |
1315 | 1313 | * @return Status |
1316 | 1314 | */ |
1317 | | - protected function generateSecretKey() { |
1318 | | - return $this->generateSecret( 'wgSecretKey' ); |
| 1315 | + public function generateKeys() { |
| 1316 | + $keys = array( 'wgSecretKey' => 64 ); |
| 1317 | + if ( strval( $this->getVar( 'wgUpgradeKey' ) ) === '' ) { |
| 1318 | + $keys['wgUpgradeKey'] = 16; |
| 1319 | + } |
| 1320 | + return $this->doGenerateKeys( $keys ); |
1319 | 1321 | } |
1320 | 1322 | |
1321 | 1323 | /** |
1322 | | - * Generate a secret value for a variable using either |
1323 | | - * /dev/urandom or mt_rand() Produce a warning in the later case. |
| 1324 | + * Generate a secret value for variables using either |
| 1325 | + * /dev/urandom or mt_rand(). Produce a warning in the later case. |
1324 | 1326 | * |
| 1327 | + * @param $keys Array |
1325 | 1328 | * @return Status |
1326 | 1329 | */ |
1327 | | - protected function generateSecret( $secretName, $length = 64 ) { |
1328 | | - if ( wfIsWindows() ) { |
1329 | | - $file = null; |
1330 | | - } else { |
1331 | | - wfSuppressWarnings(); |
1332 | | - $file = fopen( "/dev/urandom", "r" ); |
1333 | | - wfRestoreWarnings(); |
1334 | | - } |
1335 | | - |
| 1330 | + protected function doGenerateKeys( $keys ) { |
1336 | 1331 | $status = Status::newGood(); |
1337 | 1332 | |
1338 | | - if ( $file ) { |
1339 | | - $secretKey = bin2hex( fread( $file, $length / 2 ) ); |
1340 | | - fclose( $file ); |
1341 | | - } else { |
1342 | | - $secretKey = ''; |
| 1333 | + wfSuppressWarnings(); |
| 1334 | + $file = fopen( "/dev/urandom", "r" ); |
| 1335 | + wfRestoreWarnings(); |
1343 | 1336 | |
1344 | | - for ( $i = 0; $i < $length / 8; $i++ ) { |
1345 | | - $secretKey .= dechex( mt_rand( 0, 0x7fffffff ) ); |
| 1337 | + foreach ( $keys as $name => $length ) { |
| 1338 | + if ( $file ) { |
| 1339 | + $secretKey = bin2hex( fread( $file, $length / 2 ) ); |
| 1340 | + } else { |
| 1341 | + $secretKey = ''; |
| 1342 | + |
| 1343 | + for ( $i = 0; $i < $length / 8; $i++ ) { |
| 1344 | + $secretKey .= dechex( mt_rand( 0, 0x7fffffff ) ); |
| 1345 | + } |
1346 | 1346 | } |
1347 | 1347 | |
1348 | | - $status->warning( 'config-insecure-secret', '$' . $secretName ); |
| 1348 | + $this->setVar( $name, $secretKey ); |
1349 | 1349 | } |
1350 | 1350 | |
1351 | | - $this->setVar( $secretName, $secretKey ); |
| 1351 | + if ( $file ) { |
| 1352 | + fclose( $file ); |
| 1353 | + } else { |
| 1354 | + $names = array_keys ( $keys ); |
| 1355 | + $names = preg_replace( '/^(.*)$/', '\$$1', $names ); |
| 1356 | + global $wgLang; |
| 1357 | + $status->warning( 'config-insecure-keys', $wgLang->listToText( $names ), count( $names ) ); |
| 1358 | + } |
1352 | 1359 | |
1353 | 1360 | return $status; |
1354 | 1361 | } |
1355 | 1362 | |
1356 | 1363 | /** |
1357 | | - * Generate a default $wgUpgradeKey. Will warn if we had to use |
1358 | | - * mt_rand() instead of /dev/urandom |
1359 | | - * |
1360 | | - * @return Status |
1361 | | - */ |
1362 | | - public function generateUpgradeKey() { |
1363 | | - if ( strval( $this->getVar( 'wgUpgradeKey' ) ) === '' ) { |
1364 | | - return $this->generateSecret( 'wgUpgradeKey', 16 ); |
1365 | | - } |
1366 | | - return Status::newGood(); |
1367 | | - } |
1368 | | - |
1369 | | - /** |
1370 | 1364 | * Create the first user account, grant it sysop and bureaucrat rights |
1371 | 1365 | * |
1372 | 1366 | * @return Status |
Property changes on: branches/REL1_17/phase3/includes/installer/Installer.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
1373 | 1367 | Merged /branches/new-installer/phase3/includes/installer/Installer.php:r43664-66004 |
1374 | 1368 | Merged /branches/wmf-deployment/includes/installer/Installer.php:r53381 |
1375 | 1369 | Merged /branches/REL1_15/phase3/includes/installer/Installer.php:r51646 |
1376 | 1370 | Merged /branches/sqlite/includes/installer/Installer.php:r58211-58321 |
1377 | 1371 | Merged /trunk/phase3/includes/installer/Installer.php:r82845,82847-82848,84755,84875,84881-84882,84970,84976 |
Index: branches/REL1_17/phase3/includes/installer/Installer.i18n.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | To upgrade this installation, please enter the value of <code>\$wgUpgradeKey</code> in the box below. |
21 | 21 | You will find it in LocalSettings.php.", |
22 | 22 | 'config-localsettings-cli-upgrade' => 'A LocalSettings.php file has been detected. |
23 | | -To upgrade this installation, please give the --upgrade=yes option.', |
| 23 | +To upgrade this installation, please run update.php instead', |
24 | 24 | 'config-localsettings-key' => 'Upgrade key:', |
25 | 25 | 'config-localsettings-badkey' => 'The key you provided is incorrect.', |
26 | 26 | 'config-upgrade-key-missing' => 'An existing installation of MediaWiki has been detected. |
— | — | @@ -490,10 +490,8 @@ |
491 | 491 | 'config-install-interwiki-exists' => "'''Warning''': The interwiki table seems to already have entries. |
492 | 492 | Skipping default list.", |
493 | 493 | 'config-install-stats' => 'Initializing statistics', |
494 | | - 'config-install-secretkey' => 'Generating secret key', |
495 | | - 'config-insecure-secret' => "'''Warning:''' Unable to create a secure <code>$1</code>. |
496 | | -Consider changing it manually.", |
497 | | - 'config-install-upgradekey' => 'Generating default upgrade key', |
| 494 | + 'config-install-keys' => 'Generating secret keys', |
| 495 | + 'config-insecure-keys' => "'''Warning:''' {{PLURAL:$2|A secure key|Secure keys}} $1 generated during installation are not completely safe. Consider changing {{PLURAL:$2|it|them}} manually.", |
498 | 496 | 'config-install-sysop' => 'Creating administrator user account', |
499 | 497 | 'config-install-subscribe-fail' => 'Unable to subscribe to mediawiki-announce', |
500 | 498 | 'config-install-mainpage' => 'Creating main page with default content', |
Property changes on: branches/REL1_17/phase3/includes/installer/Installer.i18n.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
501 | 499 | Merged /branches/new-installer/phase3/includes/installer/Installer.i18n.php:r43664-66004 |
502 | 500 | Merged /branches/wmf-deployment/includes/installer/Installer.i18n.php:r53381 |
503 | 501 | Merged /branches/REL1_15/phase3/includes/installer/Installer.i18n.php:r51646 |
504 | 502 | Merged /branches/sqlite/includes/installer/Installer.i18n.php:r58211-58321 |
505 | 503 | Merged /trunk/phase3/includes/installer/Installer.i18n.php:r82845,82847-82848,84756,84875,84881-84882,84970,84976 |
Index: branches/REL1_17/phase3/includes/installer/WebInstallerOutput.php |
— | — | @@ -40,6 +40,14 @@ |
41 | 41 | public $redirectTarget; |
42 | 42 | |
43 | 43 | /** |
| 44 | + * Does the current page need to allow being used as a frame? |
| 45 | + * If not, X-Frame-Options will be output to forbid it. |
| 46 | + * |
| 47 | + * @var bool |
| 48 | + */ |
| 49 | + public $allowFrames = false; |
| 50 | + |
| 51 | + /** |
44 | 52 | * Whether to use the limited header (used during CC license callbacks) |
45 | 53 | * @var bool |
46 | 54 | */ |
— | — | @@ -116,6 +124,10 @@ |
117 | 125 | $this->useShortHeader = $use; |
118 | 126 | } |
119 | 127 | |
| 128 | + public function allowFrames( $allow = true ) { |
| 129 | + $this->allowFrames = $allow; |
| 130 | + } |
| 131 | + |
120 | 132 | public function flush() { |
121 | 133 | if ( !$this->headerDone ) { |
122 | 134 | $this->outputHeader(); |
— | — | @@ -163,7 +175,9 @@ |
164 | 176 | $dbTypes = $this->parent->getDBTypes(); |
165 | 177 | |
166 | 178 | $this->parent->request->response()->header( 'Content-Type: text/html; charset=utf-8' ); |
167 | | - $this->parent->request->response()->header( 'X-Frame-Options: DENY' ); |
| 179 | + if (!$this->allowFrames) { |
| 180 | + $this->parent->request->response()->header( 'X-Frame-Options: DENY' ); |
| 181 | + } |
168 | 182 | if ( $this->redirectTarget ) { |
169 | 183 | $this->parent->request->response()->header( 'Location: '.$this->redirectTarget ); |
170 | 184 | return; |
Index: branches/REL1_17/phase3/includes/installer/DatabaseInstaller.php |
— | — | @@ -494,13 +494,14 @@ |
495 | 495 | * @return String |
496 | 496 | */ |
497 | 497 | public function getWebUserBox( $noCreateMsg = false ) { |
| 498 | + $wrapperStyle = $this->getVar( '_SameAccount' ) ? 'display: none' : ''; |
498 | 499 | $s = Html::openElement( 'fieldset' ) . |
499 | 500 | Html::element( 'legend', array(), wfMsg( 'config-db-web-account' ) ) . |
500 | 501 | $this->getCheckBox( |
501 | 502 | '_SameAccount', 'config-db-web-account-same', |
502 | 503 | array( 'class' => 'hideShowRadio', 'rel' => 'dbOtherAccount' ) |
503 | 504 | ) . |
504 | | - Html::openElement( 'div', array( 'id' => 'dbOtherAccount', 'style' => 'display: none;' ) ) . |
| 505 | + Html::openElement( 'div', array( 'id' => 'dbOtherAccount', 'style' => $wrapperStyle ) ) . |
505 | 506 | $this->getTextBox( 'wgDBuser', 'config-db-username' ) . |
506 | 507 | $this->getPasswordBox( 'wgDBpassword', 'config-db-password' ) . |
507 | 508 | $this->parent->getHelpBox( 'config-db-web-help' ); |
Property changes on: branches/REL1_17/phase3/includes/installer/DatabaseInstaller.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
508 | 509 | Merged /trunk/phase3/includes/installer/DatabaseInstaller.php:r84875,84881-84882,84970,84976 |
Index: branches/REL1_17/phase3/includes/installer/CliInstaller.php |
— | — | @@ -31,9 +31,6 @@ |
32 | 32 | 'dbschema' => 'wgDBmwschema', |
33 | 33 | 'dbpath' => 'wgSQLiteDataDir', |
34 | 34 | 'scriptpath' => 'wgScriptPath', |
35 | | - 'upgrade' => 'cliUpgrade', /* As long as it isn't $confItems |
36 | | - * in LocalSettingsGenerator, we |
37 | | - * should be fine. */ |
38 | 35 | ); |
39 | 36 | |
40 | 37 | /** |
— | — | @@ -91,10 +88,8 @@ |
92 | 89 | * Main entry point. |
93 | 90 | */ |
94 | 91 | public function execute() { |
95 | | - global $cliUpgrade; |
96 | | - |
97 | 92 | $vars = $this->getExistingLocalSettings(); |
98 | | - if( $vars && ( !isset( $cliUpgrade ) || $cliUpgrade !== "yes" ) ) { |
| 93 | + if( $vars ) { |
99 | 94 | $this->showStatusMessage( |
100 | 95 | Status::newFatal( "config-localsettings-cli-upgrade" ) |
101 | 96 | ); |
Property changes on: branches/REL1_17/phase3/includes/installer/CliInstaller.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
102 | 97 | Merged /branches/sqlite/includes/installer/CliInstaller.php:r58211-58321 |
103 | 98 | Merged /trunk/phase3/includes/installer/CliInstaller.php:r82845,82847-82848,84756,84875,84881-84882,84970,84976 |
104 | 99 | Merged /branches/new-installer/phase3/includes/installer/CliInstaller.php:r43664-66004 |
105 | 100 | Merged /branches/wmf-deployment/includes/installer/CliInstaller.php:r53381 |
106 | 101 | Merged /branches/REL1_15/phase3/includes/installer/CliInstaller.php:r51646 |
Index: branches/REL1_17/phase3/includes/installer/WebInstallerPage.php |
— | — | @@ -475,6 +475,11 @@ |
476 | 476 | <script>jQuery( "#config-spinner" )[0].style.display = "none";</script>' ); |
477 | 477 | $this->parent->output->flush(); |
478 | 478 | if ( $result ) { |
| 479 | + // If they're going to possibly regenerate LocalSettings, we |
| 480 | + // need to create the upgrade/secret keys. Bug 26481 |
| 481 | + if( !$this->getVar( '_ExistingDBSettings' ) ) { |
| 482 | + $this->parent->generateKeys(); |
| 483 | + } |
479 | 484 | $this->setVar( '_UpgradeDone', true ); |
480 | 485 | $this->showDoneMessage(); |
481 | 486 | return 'output'; |
— | — | @@ -745,6 +750,7 @@ |
746 | 751 | } |
747 | 752 | } |
748 | 753 | |
| 754 | + $emailwrapperStyle = $this->getVar( 'wgEnableEmail' ) ? '' : 'display: none'; |
749 | 755 | $this->startForm(); |
750 | 756 | $this->addHTML( |
751 | 757 | # User Rights |
— | — | @@ -775,7 +781,7 @@ |
776 | 782 | 'attribs' => array( 'class' => 'showHideRadio', 'rel' => 'emailwrapper' ), |
777 | 783 | ) ) . |
778 | 784 | $this->parent->getHelpBox( 'config-enable-email-help' ) . |
779 | | - "<div id=\"emailwrapper\">" . |
| 785 | + "<div id=\"emailwrapper\" style=\"$emailwrapperStyle\">" . |
780 | 786 | $this->parent->getTextBox( array( |
781 | 787 | 'var' => 'wgPasswordSender', |
782 | 788 | 'label' => 'config-email-sender' |
— | — | @@ -830,6 +836,7 @@ |
831 | 837 | ) |
832 | 838 | ); |
833 | 839 | |
| 840 | + $uploadwrapperStyle = $this->getVar( 'wgEnableUploads' ) ? '' : 'display: none'; |
834 | 841 | $this->addHTML( |
835 | 842 | # Uploading |
836 | 843 | $this->getFieldSetStart( 'config-upload-settings' ) . |
— | — | @@ -839,7 +846,7 @@ |
840 | 847 | 'attribs' => array( 'class' => 'showHideRadio', 'rel' => 'uploadwrapper' ), |
841 | 848 | 'help' => $this->parent->getHelpBox( 'config-upload-help' ) |
842 | 849 | ) ) . |
843 | | - '<div id="uploadwrapper" style="display: none;">' . |
| 850 | + '<div id="uploadwrapper" style="' . $uploadwrapperStyle . '">' . |
844 | 851 | $this->parent->getTextBox( array( |
845 | 852 | 'var' => 'wgDeletedDirectory', |
846 | 853 | 'label' => 'config-upload-deleted', |
— | — | @@ -927,9 +934,10 @@ |
928 | 935 | } else { |
929 | 936 | $iframeAttribs['src'] = $this->getCCPartnerUrl(); |
930 | 937 | } |
| 938 | + $wrapperStyle = ($this->getVar('_LicenseCode') == 'cc-choose') ? '' : 'display: none'; |
931 | 939 | |
932 | 940 | return |
933 | | - "<div class=\"config-cc-wrapper\" id=\"config-cc-wrapper\" style=\"display: none;\">\n" . |
| 941 | + "<div class=\"config-cc-wrapper\" id=\"config-cc-wrapper\" style=\"$wrapperStyle\">\n" . |
934 | 942 | Html::element( 'iframe', $iframeAttribs, '', false /* not short */ ) . |
935 | 943 | "</div>\n"; |
936 | 944 | } |
Property changes on: branches/REL1_17/phase3/includes/installer/WebInstallerPage.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
937 | 945 | Merged /trunk/phase3/includes/installer/WebInstallerPage.php:r84875,84881-84882,84970,84976 |
Property changes on: branches/REL1_17/phase3/includes/installer |
___________________________________________________________________ |
Added: svn:mergeinfo |
938 | 946 | Merged /branches/REL1_15/phase3/includes/installer:r51646 |
939 | 947 | Merged /branches/sqlite/includes/installer:r58211-58321 |
940 | 948 | Merged /trunk/phase3/includes/installer:r82845,82847-82848,84875,84881-84882,84970,84976 |
941 | 949 | Merged /branches/new-installer/phase3/includes/installer:r43664-66004 |
942 | 950 | Merged /branches/wmf-deployment/includes/installer:r53381 |