Index: branches/new-installer/phase3/maintenance/language/messages.inc |
— | — | @@ -3205,7 +3205,7 @@ |
3206 | 3206 | 'config-dir', |
3207 | 3207 | 'config-uri', |
3208 | 3208 | 'config-no-uri', |
3209 | | - 'config-extension', |
| 3209 | + 'config-file-extension', |
3210 | 3210 | 'config-db-type', |
3211 | 3211 | 'config-db-host', |
3212 | 3212 | 'config-db-host-help', |
— | — | @@ -3325,13 +3325,15 @@ |
3326 | 3326 | 'config-cc-again', |
3327 | 3327 | 'config-cc-not-chosen', |
3328 | 3328 | 'config-advanced-settings', |
3329 | | - 'config-extension', |
3330 | | - 'config-extension-help', |
| 3329 | + 'config-extensions', |
| 3330 | + 'config-extensions-help', |
3331 | 3331 | 'config-stage-done', |
3332 | 3332 | 'config-install-extensions', |
3333 | 3333 | 'config-install-database', |
3334 | 3334 | 'config-install-schema', |
3335 | 3335 | 'config-install-tables', |
| 3336 | + 'config-install-user', |
| 3337 | + 'config-install-localsettings', |
3336 | 3338 | ), |
3337 | 3339 | ); |
3338 | 3340 | |
Index: branches/new-installer/phase3/includes/installer/Installer.php |
— | — | @@ -32,6 +32,7 @@ |
33 | 33 | // 'wgDeletedDirectory', |
34 | 34 | 'wgEnableUploads', |
35 | 35 | 'wgLogo', |
| 36 | + 'wgShellLocale' |
36 | 37 | ); |
37 | 38 | |
38 | 39 | /** |
— | — | @@ -113,6 +114,7 @@ |
114 | 115 | 'envCheckGraphics', |
115 | 116 | 'envCheckPath', |
116 | 117 | 'envCheckExtension', |
| 118 | + 'envCheckShellLocale', |
117 | 119 | ); |
118 | 120 | |
119 | 121 | /** |
— | — | @@ -581,9 +583,82 @@ |
582 | 584 | $ext = 'php'; |
583 | 585 | } |
584 | 586 | $this->setVar( 'wgScriptExtension', ".$ext" ); |
585 | | - $this->showMessage( 'config-extension', $ext ); |
| 587 | + $this->showMessage( 'config-file-extension', $ext ); |
586 | 588 | } |
587 | 589 | |
| 590 | + function envCheckShellLocale() { |
| 591 | + # Give up now if we're in safe mode or open_basedir |
| 592 | + # It's theoretically possible but tricky to work with |
| 593 | + if ( wfIniGetBool( "safe_mode" ) || ini_get( 'open_basedir' ) || !function_exists( 'exec' ) ) { |
| 594 | + return true; |
| 595 | + } |
| 596 | + |
| 597 | + $os = php_uname( 's' ); |
| 598 | + $supported = array( 'Linux', 'SunOS', 'HP-UX' ); # Tested these |
| 599 | + if ( !in_array( $os, $supported ) ) { |
| 600 | + return true; |
| 601 | + } |
| 602 | + |
| 603 | + # Get a list of available locales |
| 604 | + $lines = $ret = false; |
| 605 | + exec( '/usr/bin/locale -a', $lines, $ret ); |
| 606 | + if ( $ret ) { |
| 607 | + return true; |
| 608 | + } |
| 609 | + |
| 610 | + $lines = wfArrayMap( 'trim', $lines ); |
| 611 | + $candidatesByLocale = array(); |
| 612 | + $candidatesByLang = array(); |
| 613 | + foreach ( $lines as $line ) { |
| 614 | + if ( $line === '' ) { |
| 615 | + continue; |
| 616 | + } |
| 617 | + if ( !preg_match( '/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i', $line, $m ) ) { |
| 618 | + continue; |
| 619 | + } |
| 620 | + list( $all, $lang, $territory, $charset, $modifier ) = $m; |
| 621 | + $candidatesByLocale[$m[0]] = $m; |
| 622 | + $candidatesByLang[$lang][] = $m; |
| 623 | + } |
| 624 | + |
| 625 | + # Try the current value of LANG |
| 626 | + if ( isset( $candidatesByLocale[ getenv( 'LANG' ) ] ) ) { |
| 627 | + $this->setVar( 'wgShellLocale', getenv( 'LANG' ) ); |
| 628 | + $this->showMessage( 'config-shell-locale', getenv( 'LANG' ) ); |
| 629 | + return true; |
| 630 | + } |
| 631 | + |
| 632 | + # Try the most common ones |
| 633 | + $commonLocales = array( 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8' ); |
| 634 | + foreach ( $commonLocales as $commonLocale ) { |
| 635 | + if ( isset( $candidatesByLocale[$commonLocale] ) ) { |
| 636 | + $this->setVar( 'wgShellLocale', $commonLocale ); |
| 637 | + $this->showMessage( 'config-shell-locale', $commonLocale ); |
| 638 | + return true; |
| 639 | + } |
| 640 | + } |
| 641 | + |
| 642 | + # Is there an available locale in the Wiki's language? |
| 643 | + $wikiLang = $this->getVar( 'wgLanguageCode' ); |
| 644 | + if ( isset( $candidatesByLang[$wikiLang] ) ) { |
| 645 | + $m = reset( $candidatesByLang[$wikiLang] ); |
| 646 | + $this->setVar( 'wgShellLocale', $m[0] ); |
| 647 | + $this->showMessage( 'config-shell-locale', $m[0] ); |
| 648 | + return true; |
| 649 | + } |
| 650 | + |
| 651 | + # Are there any at all? |
| 652 | + if ( count( $candidatesByLocale ) ) { |
| 653 | + $m = reset( $candidatesByLocale ); |
| 654 | + $this->setVar( 'wgShellLocale', $m[0] ); |
| 655 | + $this->showMessage( 'config-shell-locale', $m[0] ); |
| 656 | + return true; |
| 657 | + } |
| 658 | + |
| 659 | + # Give up |
| 660 | + return true; |
| 661 | + } |
| 662 | + |
588 | 663 | /** |
589 | 664 | * Convert wikitext $text to HTML. |
590 | 665 | * |
Index: branches/new-installer/phase3/languages/messages/MessagesEn.php |
— | — | @@ -4228,7 +4228,8 @@ |
4229 | 4229 | 'config-dir' => 'Installation directory: <tt>$1</tt>', |
4230 | 4230 | 'config-uri' => 'Script URI path: <tt>$1</tt>', |
4231 | 4231 | 'config-no-uri' => '<strong>Error:</strong> Could not determine the current URI. Installation aborted.', |
4232 | | -'config-extension' => 'Installing MediaWiki with <tt>$1</tt> file extensions', |
| 4232 | +'config-file-extension' => 'Installing MediaWiki with <tt>$1</tt> file extensions', |
| 4233 | +'config-shell-locale' => 'Detected shell locale, $1', |
4233 | 4234 | |
4234 | 4235 | 'config-db-type' => 'Database type:', |
4235 | 4236 | 'config-db-host' => 'Database host:', |
— | — | @@ -4414,8 +4415,8 @@ |
4415 | 4416 | 'config-cc-not-chosen' => 'Please choose which Creative Commons license you want and click "proceed".', |
4416 | 4417 | 'config-advanced-settings' => 'Advanced configuration', |
4417 | 4418 | |
4418 | | -'config-extension' => 'Extensions', |
4419 | | -'config-extension-help' => "The following extensions were automatically detected in your extensions directory.\n |
| 4419 | +'config-extensions' => 'Extensions', |
| 4420 | +'config-extensions-help' => "The following extensions were automatically detected in your extensions directory.\n |
4420 | 4421 | They may require additional configuration, but you can enable them now", |
4421 | 4422 | |
4422 | 4423 | 'config-stage-done' => 'done', |
— | — | @@ -4423,6 +4424,8 @@ |
4424 | 4425 | 'config-install-database' => 'Setting up database', |
4425 | 4426 | 'config-install-schema' => 'Generating schema', |
4426 | 4427 | 'config-install-tables' => 'Creating tables', |
| 4428 | +'config-install-user' => 'Creating admin user', |
| 4429 | +'config-install-localsettings' => 'Writing LocalSettings.php', |
4427 | 4430 | |
4428 | 4431 | # Special:Version |
4429 | 4432 | 'version' => 'Version', |