Index: trunk/phase3/includes/installer/WebInstaller.php |
— | — | @@ -746,6 +746,52 @@ |
747 | 747 | } |
748 | 748 | |
749 | 749 | /** |
| 750 | + * Get a labelled textarea to configure a variable |
| 751 | + * |
| 752 | + * @param $params Array |
| 753 | + * Parameters are: |
| 754 | + * var: The variable to be configured (required) |
| 755 | + * label: The message name for the label (required) |
| 756 | + * attribs: Additional attributes for the input element (optional) |
| 757 | + * controlName: The name for the input element (optional) |
| 758 | + * value: The current value of the variable (optional) |
| 759 | + * help: The html for the help text (optional) |
| 760 | + */ |
| 761 | + public function getTextArea( $params ) { |
| 762 | + if ( !isset( $params['controlName'] ) ) { |
| 763 | + $params['controlName'] = 'config_' . $params['var']; |
| 764 | + } |
| 765 | + |
| 766 | + if ( !isset( $params['value'] ) ) { |
| 767 | + $params['value'] = $this->getVar( $params['var'] ); |
| 768 | + } |
| 769 | + |
| 770 | + if ( !isset( $params['attribs'] ) ) { |
| 771 | + $params['attribs'] = array(); |
| 772 | + } |
| 773 | + if ( !isset( $params['help'] ) ) { |
| 774 | + $params['help'] = ""; |
| 775 | + } |
| 776 | + return |
| 777 | + $this->label( |
| 778 | + $params['label'], |
| 779 | + $params['controlName'], |
| 780 | + Xml::textarea( |
| 781 | + $params['controlName'], |
| 782 | + $params['value'], |
| 783 | + 30, |
| 784 | + 5, |
| 785 | + $params['attribs'] + array( |
| 786 | + 'id' => $params['controlName'], |
| 787 | + 'class' => 'config-input-text', |
| 788 | + 'tabindex' => $this->nextTabIndex() |
| 789 | + ) |
| 790 | + ), |
| 791 | + $params['help'] |
| 792 | + ); |
| 793 | + } |
| 794 | + |
| 795 | + /** |
750 | 796 | * Get a labelled password box to configure a variable. |
751 | 797 | * |
752 | 798 | * Implements password hiding |
Index: trunk/phase3/includes/installer/Installer.i18n.php |
— | — | @@ -438,7 +438,14 @@ |
439 | 439 | 'config-cache-memcached' => 'Use Memcached (requires additional setup and configuration)', |
440 | 440 | 'config-memcached-servers' => 'Memcached servers:', |
441 | 441 | 'config-memcached-help' => 'List of IP addresses to use for Memcached. |
442 | | -Should be separated with commas and specify the port to be used (for example: 127.0.0.1:11211, 192.168.1.25:11211).', |
| 442 | +Should specify one per line and specify the port to be used. For example: |
| 443 | + 127.0.0.1:11211 |
| 444 | + 192.168.1.25:1234', |
| 445 | + 'config-memcache-needservers' => 'You selected Memcached as your cache type but did not specify any servers', |
| 446 | + 'config-memcache-badip' => 'You have entered an invalid IP address for Memcached: $1', |
| 447 | + 'config-memcache-noport' => 'You did not specify a port to use for Memcached server: $1. |
| 448 | +If you do not know the port, the default is 11211', |
| 449 | + 'config-memcache-badport' => 'Memcached port numbers should be between $1 and $2', |
443 | 450 | 'config-extensions' => 'Extensions', |
444 | 451 | 'config-extensions-help' => 'The extensions listed above were detected in your <code>./extensions</code> directory. |
445 | 452 | |
Index: trunk/phase3/includes/installer/WebInstallerPage.php |
— | — | @@ -867,7 +867,7 @@ |
868 | 868 | ) ) . |
869 | 869 | $this->parent->getHelpBox( 'config-cache-help' ) . |
870 | 870 | '<div id="config-memcachewrapper">' . |
871 | | - $this->parent->getTextBox( array( |
| 871 | + $this->parent->getTextArea( array( |
872 | 872 | 'var' => '_MemCachedServers', |
873 | 873 | 'label' => 'config-memcached-servers', |
874 | 874 | 'help' => $this->parent->getHelpBox( 'config-memcached-help' ) |
— | — | @@ -1002,6 +1002,28 @@ |
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | $this->parent->setVar( '_Extensions', $extsToInstall ); |
| 1006 | + |
| 1007 | + if( $this->getVar( 'wgMainCacheType' ) == 'memcached' ) { |
| 1008 | + $memcServers = explode( "\n", $this->getVar( '_MemCachedServers' ) ); |
| 1009 | + if( !$memcServers ) { |
| 1010 | + $this->parent->showError( 'config-memcache-needservers' ); |
| 1011 | + return false; |
| 1012 | + } |
| 1013 | + |
| 1014 | + foreach( $memcServers as $server ) { |
| 1015 | + $memcParts = explode( ":", $server ); |
| 1016 | + if( !IP::isValid( $memcParts[0] ) ) { |
| 1017 | + $this->parent->showError( 'config-memcache-badip', $memcParts[0] ); |
| 1018 | + return false; |
| 1019 | + } elseif( !isset( $memcParts[1] ) ) { |
| 1020 | + $this->parent->showError( 'config-memcache-noport', $memcParts[0] ); |
| 1021 | + return false; |
| 1022 | + } elseif( $memcParts[1] < 1 || $memcParts[1] > 65535 ) { |
| 1023 | + $this->parent->showError( 'config-memcache-badport', 1, 65535 ); |
| 1024 | + return false; |
| 1025 | + } |
| 1026 | + } |
| 1027 | + } |
1006 | 1028 | return true; |
1007 | 1029 | } |
1008 | 1030 | |