Index: trunk/phase3/includes/installer/WebInstaller.php |
— | — | @@ -332,6 +332,25 @@ |
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
| 336 | + * Get a hash of data identifying this MW installation. |
| 337 | + * |
| 338 | + * This is used by config/index.php to prevent multiple installations of MW |
| 339 | + * on the same cookie domain from interfering with each other. |
| 340 | + */ |
| 341 | + public function getFingerprint() { |
| 342 | + // Get the base URL of the installation |
| 343 | + $url = $this->request->getFullRequestURL(); |
| 344 | + if ( preg_match( '!^(.*)/[^/]*/[^/]*$!', $url, $m ) ) { |
| 345 | + $url = $m[1]; |
| 346 | + } |
| 347 | + return md5( serialize( array( |
| 348 | + 'local path' => dirname( dirname( __FILE__ ) ), |
| 349 | + 'url' => $url, |
| 350 | + 'version' => $GLOBALS['wgVersion'] |
| 351 | + ) ) ); |
| 352 | + } |
| 353 | + |
| 354 | + /** |
336 | 355 | * Show an error message in a box. Parameters are like wfMsg(). |
337 | 356 | */ |
338 | 357 | public function showError( $msg /*...*/ ) { |
— | — | @@ -929,4 +948,4 @@ |
930 | 949 | return $url; |
931 | 950 | } |
932 | 951 | |
933 | | -} |
\ No newline at end of file |
| 952 | +} |
Index: trunk/phase3/config/index.php |
— | — | @@ -11,27 +11,38 @@ |
12 | 12 | chdir( ".." ); |
13 | 13 | require( './includes/WebStart.php' ); |
14 | 14 | |
15 | | -$installer = new WebInstaller( $wgRequest ); |
| 15 | +wfInstallerMain(); |
16 | 16 | |
17 | | -if ( !$installer->startSession() ) { |
18 | | - $installer->finish(); |
19 | | - exit; |
20 | | -} |
| 17 | +function wfInstallerMain() { |
| 18 | + global $wgRequest, $wgLang, $wgMetaNamespace, $wgCanonicalNamespaceNames; |
21 | 19 | |
22 | | -$session = isset( $_SESSION['installData'] ) ? $_SESSION['installData'] : array(); |
| 20 | + $installer = new WebInstaller( $wgRequest ); |
23 | 21 | |
24 | | -if ( isset( $session['settings']['_UserLang'] ) ) { |
25 | | - $langCode = $session['settings']['_UserLang']; |
26 | | -} elseif ( !is_null( $wgRequest->getVal( 'UserLang' ) ) ) { |
27 | | - $langCode = $wgRequest->getVal( 'UserLang' ); |
28 | | -} else { |
29 | | - $langCode = 'en'; |
30 | | -} |
31 | | -$wgLang = Language::factory( $langCode ); |
| 22 | + if ( !$installer->startSession() ) { |
| 23 | + $installer->finish(); |
| 24 | + exit; |
| 25 | + } |
32 | 26 | |
33 | | -$wgMetaNamespace = $wgCanonicalNamespaceNames[NS_PROJECT]; |
| 27 | + $fingerprint = $installer->getFingerprint(); |
| 28 | + if ( isset( $_SESSION['installData'][$fingerprint] ) ) { |
| 29 | + $session = $_SESSION['installData'][$fingerprint]; |
| 30 | + } else { |
| 31 | + $session = array(); |
| 32 | + } |
34 | 33 | |
35 | | -$session = $installer->execute( $session ); |
| 34 | + if ( isset( $session['settings']['_UserLang'] ) ) { |
| 35 | + $langCode = $session['settings']['_UserLang']; |
| 36 | + } elseif ( !is_null( $wgRequest->getVal( 'UserLang' ) ) ) { |
| 37 | + $langCode = $wgRequest->getVal( 'UserLang' ); |
| 38 | + } else { |
| 39 | + $langCode = 'en'; |
| 40 | + } |
| 41 | + $wgLang = Language::factory( $langCode ); |
36 | 42 | |
37 | | -$_SESSION['installData'] = $session; |
| 43 | + $wgMetaNamespace = $wgCanonicalNamespaceNames[NS_PROJECT]; |
38 | 44 | |
| 45 | + $session = $installer->execute( $session ); |
| 46 | + |
| 47 | + $_SESSION['installData'][$fingerprint] = $session; |
| 48 | + |
| 49 | +} |