id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses
20499,Memcached plugin version 2.0.2 does not work with single site installation,toddlahman,toddlahman,"The old 2.0 Memcached plugin properly detected the global $blog_id variable if defined in wp-config.php, but version 2.0.2 does not. The current code only checks to see if is_multisite as such:
{{{
global $blog_id, $table_prefix;
$this->global_prefix = '';
$this->blog_prefix = '';
if ( function_exists( 'is_multisite' ) ) {
$this->global_prefix = ( is_multisite() || defined('CUSTOM_USER_TABLE') && defined('CUSTOM_USER_META_TABLE') ) ? '' : $table_prefix;
$this->blog_prefix = ( is_multisite() ? $blog_id : $table_prefix ) . ':';
}
}}}
I have modified this so it will give a proper value to the global $blog_id and $table_prefix variables to work with a single site installation as shown below:
{{{
global $blog_id, $table_prefix;
$this->global_prefix = '';
$this->blog_prefix = '';
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
$this->global_prefix = ( is_multisite() || defined('CUSTOM_USER_TABLE') && defined('CUSTOM_USER_META_TABLE') ) ? '' : $table_prefix;
$this->blog_prefix = ( is_multisite() ? $blog_id : $table_prefix ) . ':';
} else {
$this->global_prefix = $table_prefix;
$this->blog_prefix = $blog_id;
}
}}}
Would be nice if the global $blog_id variable for a single site installation would default to the domain name listed in Site Address or WordPress Address from the database, rather than having a default value of 1. Using the domain name as the $blog_id variable would allow multiple single site installations on the same server to have a unique default $blog_id, and to use Memcached with this Memcached plugin without the need to set a global $blog_id variable in wp-config.php. A similar approach to having a unique globabl $group variable would also be helpful for the same reason if the batcache plugin is used.",defect (bug),closed,normal,,Cache API,,normal,invalid,,,