If the database has been manually altered, and you're running an object
cache.. the simplest solution is to just reload your object cache (ie.
the caches back up.
time..
Post by Tom BarrettIt's not that it is set to be deleted, it is that the row in the database
has been deleted and the tables dropped (probably via the 'delete site'
network admin menu, but it's a dev environment with other developers).
I've not had time to look into something re-createable, but to illustrate
my point, this would be the pseudo-code steps to replicate the issue (the
aim being here to explain that there is no row in wp_blogs to match the
blogid that the function returns).
1. Set up WP Network
2. Create 2 new blogs (you now have blog IDs 1,2,3)
3. DELETE from wp_blogs WHERE blog_id=2
4. DROP tables like 'wp_2%'
5. $sites = wp_get_sites();
At this point, assuming the issue is that simple, $sites=array( 1, 2, 3 ),
even though blog 2 has been deleted.
That's why I assumed that the SQL cached somewhere.
function tcb_find_blogs_to_archive(){
$blogs = wp_get_sites();
$archive = array();
foreach( $blogs as $blogid => $blog ){
$state = get_blog_option( $blogid, 'my_blog_state', 'live' );
if( $state == 'archive' ){
$archive[$blogid] = $blog;
}
}
return $archive;
}
WordPress database error Table 'testdb.wp_4_options' doesn't exist for
query SELECT option_value FROM wp_4_options WHERE option_name =
'my_blog_state' LIMIT 1 made by require_once('wp-admin/admin.php')...
I don't understand how the 'deleted' argument would make any difference in
this case (unless it is being cached somewhere)?
Or am I just not grokking this? ;p
Post by OttoThe wp_get_sites function isn't cached. It selects the data directly from
the database. You can see the code yourself at the bottom of
wp-includes/ms-functions.php.
If you want it to not return deleted sites, you need to pass it deleted=0
as an argument.
-Otto
Post by Tom BarrettCan anyone point me to where the data returned by this function is
cached?
Post by Tom BarrettIt is continuing to include a blog that was deleted days ago, I'm
having
Post by Ottoto
Post by Tom Barrettcheck against get_blog_details() in order to stop SQL errors trying to
look
Post by Tom Barrettup against tables that don't exist.
Thanks!
--
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers