[wp-trac] [WordPress Trac] #14992: When Object Caching is enabled switch_to_blog causes issues with some functions
WordPress Trac
wp-trac at lists.automattic.com
Wed Sep 12 05:34:10 UTC 2012
#14992: When Object Caching is enabled switch_to_blog causes issues with some
functions
---------------------------+-------------------------
Reporter: simonwheatley | Owner:
Type: defect (bug) | Status: closed
Priority: high | Milestone:
Component: Multisite | Version:
Severity: major | Resolution: worksforme
Keywords: |
---------------------------+-------------------------
Changes (by wonderboymusic):
* keywords: dev-feedback 3.2-early =>
* status: new => closed
* resolution: => worksforme
* milestone: Future Release =>
Comment:
Using Memcached Object Cache
This works for me right away in trunk:
{{{
php -r "require 'wp-load.php'; echo get_permalink(1); switch_to_blog(2);
echo get_permalink(1);"
}}}
The more advanced use case also works right away:
{{{
// post with ID #10 exists in both blogs
wp_insert_post( array( 'post_title' => 'Cash Money', 'ID' => 10,
'post_status' => 'publish' ) );
switch_to_blog( 2 );
wp_insert_post( array( 'post_title' => 'Money Cash', 'ID' => 10,
'post_status' => 'publish' ) );
switch_to_blog( 1 );
get_post( 10 );
restore_current_blog();
wp_update_post( array( 'post_title' => 'Cache Money', 'ID' => 10 ) );
$z = get_post( 10 );
echo $z->post_title . PHP_EOL;
switch_to_blog( 1 );
$z = get_post( 10 );
echo $z->post_title . PHP_EOL;
switch_to_blog( 2 );
$z = get_post( 10 );
echo $z->post_title . PHP_EOL;
exit();
}}}
I think these problems pre-date all of the switch_to_blog work Ryan has
done recently: [21485], #21595, [21628], [21403], #21434
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14992#comment:19>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list