[wp-hackers] wp_get_sites cache/transient
Tom Barrett
tcbarrett at gmail.com
Wed Feb 19 12:33:35 UTC 2014
There are no cache defines in wp-config.php
Neither memcache, nor apc are installed on the host.
I used the example of deleting table rows to emphasize that there is no row
(with 'deleted'=1) in the database.
So, I can see no reason why anything other than WordPress is caching the
existence of the blog.
On 19 February 2014 12:21, Dion Hulse (dd32) <wordpress at dd32.id.au> wrote:
> 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.
> reload php-fpm, clear memcache, clear apc, whatever) and let WordPress fill
> the caches back up.
>
> If it's a development platform that shouldn't be an issue - and tell the
> other developers not to alter raw data while there's caching involved next
> time..
>
>
> On 19 February 2014 23:16, Tom Barrett <tcbarrett at gmail.com> wrote:
>
> > It'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.
> >
> > I'll add a little context here, for any googling:
> > This is the code:
> > 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;
> > }
> >
> > Generates this error:
> > 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
> >
> >
> >
> >
> > On 19 February 2014 09:55, Otto <otto at ottodestruct.com> wrote:
> >
> > > The 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
> > >
> > >
> > >
> > > On Wed, Feb 19, 2014 at 3:46 AM, Tom Barrett <tcbarrett at gmail.com>
> > wrote:
> > >
> > > > Can anyone point me to where the data returned by this function is
> > > cached?
> > > >
> > > > It is continuing to include a blog that was deleted days ago, I'm
> > having
> > > to
> > > > check against get_blog_details() in order to stop SQL errors trying
> to
> > > look
> > > > up against tables that don't exist.
> > > >
> > > > Thanks!
> > > >
> > > > --
> > > > http://www.tcbarrett.com | http://gplus.to/tcbarrett |
> > > > http://twitter.com/tcbarrett
> > > > _______________________________________________
> > > > wp-hackers mailing list
> > > > wp-hackers at lists.automattic.com
> > > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > > >
> > > _______________________________________________
> > > wp-hackers mailing list
> > > wp-hackers at lists.automattic.com
> > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > >
> >
> >
> >
> > --
> > http://www.tcbarrett.com | http://gplus.to/tcbarrett |
> > http://twitter.com/tcbarrett
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
--
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett
More information about the wp-hackers
mailing list