Mcachesock #12

Merged
petermolnar merged 2 commits from mcachesock into master 2014-04-03 15:57:12 +01:00
2 changed files with 17 additions and 13 deletions

View file

@ -387,14 +387,13 @@ if (!class_exists('WP_FFPC_Backend')) {
$separator = strpos( $sstring , self::port_separator );
$host = substr( $sstring, 0, $separator );
$port = substr( $sstring, $separator + 1 );
// unix socket failsafe
if ( empty ($port) ) $port = 0;
/* IP server */
if ( !empty ( $host ) && !empty($port) && is_numeric($port) ) {
$this->options['servers'][$sstring] = array (
'host' => $host,
'port' => $port
);
}
$this->options['servers'][$sstring] = array (
'host' => $host,
'port' => $port
);
}
}
@ -692,11 +691,16 @@ if (!class_exists('WP_FFPC_Backend')) {
/* adding servers */
foreach ( $this->options['servers'] as $server_id => $server ) {
/* reset server status to unknown */
if ( $this->options['persistent'] == '1' )
$this->status[$server_id] = $this->connection->pconnect ( $server['host'] , $server['port'] );
$conn = 'pconnect';
else
$this->status[$server_id] = $this->connection->connect ( $server['host'] , $server['port'] );
$conn = 'connect';
/* in case of unix socket */
if ( $server['port'] === 0 )
$this->status[$server_id] = $this->connection->$conn ( 'unix:/' . $server['host'] );
else
$this->status[$server_id] = $this->connection->$conn ( $server['host'] , $server['port'] );
$this->log ( $server_id . __translate__(" added, persistent mode: ", $this->plugin_constant ) . $this->options['persistent'] );
}

View file

@ -250,9 +250,8 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
/**
* uninstall hook function, to be extended
* [TODO] static abstraction is not allowed in PHP; how to do this?
*/
static public function plugin_uninstall( $delete_options = true ) {
public function plugin_uninstall( $delete_options = true ) {
/* delete advanced-cache.php file */
unlink ( $this->acache );
@ -606,7 +605,8 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
</dt>
<dd>
<input type="text" name="hosts" id="hosts" value="<?php echo $this->options['hosts']; ?>" />
<span class="description"><?php _e('List all valid like host:port,host:port,... <br />No spaces are allowed, please stick to use ":" for separating host and port and "," for separating entries. Do not add trailing ",".', $this->plugin_constant); ?></span>
<span class="description">
<?php _e('List of memcached backends, with the following syntax: <br />- in case of TCP based connections, list the servers as host1:port1,host2:port2,... . Do not add trailing , and always separate host and port with : .<br />- in2.0.0b1 case using unix sockets with the Memcache driver: unix:// ', $this->plugin_constant); ?></span>
</dd>
<dt>
<label for="persistent"><?php _e('Persistent memcache connections', $this->plugin_constant); ?></label>