[wp-trac] [WordPress Trac] #20499: Memcached plugin version 2.0.2 does not work with single site installation
WordPress Trac
wp-trac at lists.automattic.com
Sat Apr 21 00:56:19 UTC 2012
#20499: Memcached plugin version 2.0.2 does not work with single site installation
--------------------------+-----------------------------
Reporter: toddlahman | Owner: toddlahman
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cache | Version: 3.3.1
Severity: major | Keywords: has-patch
--------------------------+-----------------------------
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.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20499>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list