Add code to noindex() to sync the 'public' value in the site options table with the blog_public value in the options table.
fixes#23155
git-svn-id: http://core.svn.wordpress.org/trunk@23794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Correctly specify the backreference in the regular expression so that it can not become ambiguous when there is a leading digit on the blogname.
Fixes#23689 props dllh.
git-svn-id: http://core.svn.wordpress.org/trunk@23686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Introduce clean_blog_cache() so we can run it independently of refresh_blog_details() which assumes the blog still exists and get_blog_details() can be called.
* Don't db escape cache keys in get_blog_id_from_url()
* prepare() the query in get_blog_id_from_url()
* Return 0 for all failures in get_blog_id_from_url()
* clean_blog_cache() after dropping tables in wpmu_delete_blog() to make sure the cache is for real cleaned.
git-svn-id: http://core.svn.wordpress.org/trunk@22092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Change $name to $slug in get_id_from_blogname() for some semblance of clarity.
* Strip leading and trailing slashes from the slug in get_id_from_blogname() so get_blog_details()->path can be passed directly.
Props wonderboymusic
see #20950
git-svn-id: http://core.svn.wordpress.org/trunk@21979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
wp-includes/admin-bar.php:
* Replace get_admin_url() and get_home_url() with admin_url() and home_url() and place them inside a switch/restore. Likewise replace current_user_can_for_blog() with current_user_can(). This avoids doing multiple switch restores.
wp-includes/ms-blogs.php:
* Deprecate the $validate argument to switch_to_blog(). This avoids a not very necessary call to get_blog_details(), possibly saving a few queries.
* Use $_wp_switched and $_wp_switched_stack instead of $switched and $switched_stack to make it less likely these globals will be stomped.
* Use GLOBALS to access blog_id and other globals. I've preferred this style lately since it makes it obvious a global is being used and avoids global blog_id being stomped by a local variable.
* Lose some is_object() checks. wp_get_current_user() always returns an object, for example.
* Call the new WP_Roles::reinit() method.
wp-includes/class-wp-xmlrpc-server.php:
* Replace current_user_can_for_blog() with current_user_can() and move it inside the switch/restore pair. This eliminates a switch/restore.
wp-includes/capabilities.php:
* Use array_keys() instead of $role => $data since $data is unused. I *think* this is a bit faster.
* Introduce WP_Roles::reinit(). This reinitializes WP_Roles and is used after switch_to_blog() has already update the blog ID in the wpdb object. If a global roles array is being used instead of the db, reinit is skipped.
* current_user_can_for_blog() now does a switch/restore. It didn't before meaning it could be reinitializing the user with the wrong role information for the current blog.
wp-includes/ms-settings.php:
* Define $_wp_switched_stack and $_wp_switched. This way switch_to_blog() and restore_current_blog() can rely on it being set.
wp-settings.php:
* Instantiate the WP_Roles global. This was it is always defined during init. To remove the WP_Roles checks from WP_Role and WP_User this would probably have to move before plugins are loaded, which might not be a good thing.
wp-includes/functions.php:
* Update wp_upload_dir() to reference _wp_switched.
git-svn-id: http://core.svn.wordpress.org/trunk@21485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Use the regular option functions wrapped in switch_to_blog() and restore_current_blog() instead.
Group multiple operations within a single switch where possible.
fixes#21432
git-svn-id: http://core.svn.wordpress.org/trunk@21414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add the blog id to the cache keys for multisite installs.
Use wp_cache_switch_to_blog() instead of wp_cache_init() in switch_to_blog().
Use wp_cache_switch_to_blog() instead of wp_cache_reset() in wp_start_object_cache().
Deprecate wp_cache_reset().
This avoids the many queries needed to re-prime the cache after switch_to_blog() on multisite installs using the default cache backend.
fixes#21434
git-svn-id: http://core.svn.wordpress.org/trunk@21403 1a063a9b-81f0-0310-95a4-ce76da25c4cd