'config-cache-memcached' => 'Use Memcached (requires additional setup and configuration)',
'config-memcached-servers' => 'Memcached servers:',
'config-memcached-help' => 'List of IP addresses to use for Memcached.
-Should be separated with commas and specify the port to be used (for example: 127.0.0.1:11211, 192.168.1.25:11211).',
+Should specify one per line and specify the port to be used. For example:
+ 127.0.0.1:11211
+ 192.168.1.25:1234',
+ 'config-memcache-needservers' => 'You selected Memcached as your cache type but did not specify any servers',
+ 'config-memcache-badip' => 'You have entered an invalid IP address for Memcached: $1',
+ 'config-memcache-noport' => 'You did not specify a port to use for Memcached server: $1.
+If you do not know the port, the default is 11211',
+ 'config-memcache-badport' => 'Memcached port numbers should be between $1 and $2',
'config-extensions' => 'Extensions',
'config-extensions-help' => 'The extensions listed above were detected in your <code>./extensions</code> directory.
);
}
+ /**
+ * Get a labelled textarea to configure a variable
+ *
+ * @param $params Array
+ * Parameters are:
+ * var: The variable to be configured (required)
+ * label: The message name for the label (required)
+ * attribs: Additional attributes for the input element (optional)
+ * controlName: The name for the input element (optional)
+ * value: The current value of the variable (optional)
+ * help: The html for the help text (optional)
+ */
+ public function getTextArea( $params ) {
+ if ( !isset( $params['controlName'] ) ) {
+ $params['controlName'] = 'config_' . $params['var'];
+ }
+
+ if ( !isset( $params['value'] ) ) {
+ $params['value'] = $this->getVar( $params['var'] );
+ }
+
+ if ( !isset( $params['attribs'] ) ) {
+ $params['attribs'] = array();
+ }
+ if ( !isset( $params['help'] ) ) {
+ $params['help'] = "";
+ }
+ return
+ $this->label(
+ $params['label'],
+ $params['controlName'],
+ Xml::textarea(
+ $params['controlName'],
+ $params['value'],
+ 30,
+ 5,
+ $params['attribs'] + array(
+ 'id' => $params['controlName'],
+ 'class' => 'config-input-text',
+ 'tabindex' => $this->nextTabIndex()
+ )
+ ),
+ $params['help']
+ );
+ }
+
/**
* Get a labelled password box to configure a variable.
*
) ) .
$this->parent->getHelpBox( 'config-cache-help' ) .
'<div id="config-memcachewrapper">' .
- $this->parent->getTextBox( array(
+ $this->parent->getTextArea( array(
'var' => '_MemCachedServers',
'label' => 'config-memcached-servers',
'help' => $this->parent->getHelpBox( 'config-memcached-help' )
}
}
$this->parent->setVar( '_Extensions', $extsToInstall );
+
+ if( $this->getVar( 'wgMainCacheType' ) == 'memcached' ) {
+ $memcServers = explode( "\n", $this->getVar( '_MemCachedServers' ) );
+ if( !$memcServers ) {
+ $this->parent->showError( 'config-memcache-needservers' );
+ return false;
+ }
+
+ foreach( $memcServers as $server ) {
+ $memcParts = explode( ":", $server );
+ if( !IP::isValid( $memcParts[0] ) ) {
+ $this->parent->showError( 'config-memcache-badip', $memcParts[0] );
+ return false;
+ } elseif( !isset( $memcParts[1] ) ) {
+ $this->parent->showError( 'config-memcache-noport', $memcParts[0] );
+ return false;
+ } elseif( $memcParts[1] < 1 || $memcParts[1] > 65535 ) {
+ $this->parent->showError( 'config-memcache-badport', 1, 65535 );
+ return false;
+ }
+ }
+ }
return true;
}