WordPress/wp-includes
ryan d286875515 switch_to_blog() and restore_current_blog() housekeeping.
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
2012-08-09 16:28:15 +00:00
..
css Compress scripts/styles: 3.5-alpha-21460. 2012-08-06 18:58:29 +00:00
images Retina: fix the icon positions in the original editor buttons sprite, reset the css tweaks and adjust the positions in the 2x sprite, see #21019 2012-07-20 23:07:48 +00:00
js TinyMCE: fix typo in button tooltips. 2012-08-07 03:28:20 +00:00
pomo Avoid 'Only variables should be passed by reference' warnings. Props SergeyBiryukov. see #18975 2011-10-27 20:00:09 +00:00
Text
theme-compat Introduce get_edit_user_link(). Props scribu, georgestephanis, johnbillion. fixes #14787 see #20307 2012-07-30 18:30:03 +00:00
admin-bar.php switch_to_blog() and restore_current_blog() housekeeping. 2012-08-09 16:28:15 +00:00
atomlib.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
author-template.php Add 'author' to rel attribute for get_the_author_link(). props sirzooro, CoenJacobs, Ipstenu. fixes #20047. 2012-04-27 18:17:41 +00:00
bookmark-template.php Bunch of PHPDoc corrections and cleanups. props c3mdigital. props SergeyBiryukov. fixes #21149 2012-07-09 05:03:53 +00:00
bookmark.php Use wp_cache_add() instead of wp_cache_set() when priming the object term cache in update_object_term_cache(). Pass the real post_type to clean_object_term_cache() instead of hard-coding post. Call clean_object_term_cache() from clean_bookmark_cache(). Props leewillis77. fixes #19690 2012-01-11 21:26:18 +00:00
cache.php Introduce wp_cache_switch_to_blog() and WP_Object_Cache::switch_to_blog() as a lighter/faster way to switch the cache to a new blog id. 2012-08-02 18:31:14 +00:00
canonical.php Also switch back the @uses annotation for [21215]. props duck_. see #20484. see #16639 2012-07-05 20:09:28 +00:00
capabilities.php switch_to_blog() and restore_current_blog() housekeeping. 2012-08-09 16:28:15 +00:00
category-template.php Replace commas with periods when converting ratings float values to strings, to avoid issues with localized decimal points. 2012-05-01 22:09:55 +00:00
category.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
class-feed.php Use wp_remote_retrieve_* helper functions instead of the raw HTTP response array. props aaroncampbell, fixes #17416. 2011-05-14 19:45:07 +00:00
class-http.php Fix typo in HTTP docblock. props ocean90. fixes #21215. 2012-07-20 15:09:11 +00:00
class-IXR.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
class-json.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
class-oembed.php ALIGN *ALL* THE THINGS! see #20324 2012-05-24 07:14:10 +00:00
class-phpass.php Fix typos in documentation (wp-includes/[a-h]). See #18560. 2011-09-03 16:02:41 +00:00
class-phpmailer.php Do not pass mail() a fourth argument when safe_mode is in effect. 2012-06-26 03:54:17 +00:00
class-pop3.php Update pop3 class. Props aaroncampbell. fixes #17064 2011-04-21 20:40:32 +00:00
class-simplepie.php Pinking shears 2012-05-03 16:41:59 +00:00
class-smtp.php Upgrade PHPMailer to 5.2.1. Props MattyRob. fixes #19887 2012-02-07 16:13:51 +00:00
class-snoopy.php
class-wp-admin-bar.php Accessibility: add off-screen Log Out link in the toolbar, tweak the class names of the accessible links in #adminbar, see #21312 2012-08-06 00:34:44 +00:00
class-wp-ajax-response.php Make sure we are using the admin-ajax handler when we call wp_die() for WP_Ajax_Response. see #20024. 2012-02-12 19:02:07 +00:00
class-wp-atom-server.php Pinking shears 2012-05-03 16:41:59 +00:00
class-wp-customize-control.php Fix @since blocks... since we already released 3.4.1. see #21355. 2012-08-01 07:20:44 +00:00
class-wp-customize-manager.php phpdoc for Customizer classes and methods. Props bananastalktome. see #21303 2012-07-26 21:45:33 +00:00
class-wp-customize-section.php phpdoc for Customizer classes and methods. Props bananastalktome. see #21303 2012-07-26 21:45:33 +00:00
class-wp-customize-setting.php phpdoc for Customizer classes and methods. Props bananastalktome. see #21303 2012-07-26 21:45:33 +00:00
class-wp-editor.php Add translation context for the Text editor tab name, props obenland, fixes #20993 2012-08-03 21:08:52 +00:00
class-wp-error.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
class-wp-http-ixr-client.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
class-wp-theme.php Deprecate get_blog_option(), add_blog_option(), update_blog_option(), and delete_blog_option(). 2012-08-03 17:51:42 +00:00
class-wp-walker.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
class-wp-xmlrpc-server.php switch_to_blog() and restore_current_blog() housekeeping. 2012-08-09 16:28:15 +00:00
class-wp.php Allow home page of multisite (subdir install) sites to resolve regardless of capitalization, as they already do for URLs other than the home page. props SergeyBiryukov. fixes #16200 2012-07-05 13:50:24 +00:00
class.wp-dependencies.php When WP_Dependencies accept a string for a single dependency, make sure the string is not empty, see #20683 2012-08-08 17:21:24 +00:00
class.wp-scripts.php Allow protocol-relative URLs when registering/enqueueing scripts and styles. 2012-06-28 20:18:38 +00:00
class.wp-styles.php Allow protocol-relative URLs when registering/enqueueing scripts and styles. 2012-06-28 20:18:38 +00:00
comment-template.php Introduce get_edit_user_link(). Props scribu, georgestephanis, johnbillion. fixes #14787 see #20307 2012-07-30 18:30:03 +00:00
comment.php Move most instances of new WP_User to get_userdata(). see #21120. 2012-08-03 01:06:05 +00:00
compat.php Restore compat for json_decode and json_encode. fixes #18015 for trunk. 2011-07-06 23:33:05 +00:00
cron.php Introduce cron_request filter. Props ikailo. fixes #13449 2012-07-20 15:15:22 +00:00
default-constants.php s/inval/intval/. props PeteMall. see #14889. 2012-06-28 20:24:50 +00:00
default-filters.php Escape editable_slug as a textarea. 2012-06-10 17:58:57 +00:00
default-widgets.php Use get_taxonomies() instead of get_object_taxonomies() in the tag cloud widget. props GautamGupta, scribu. see #20238, see #16125. 2012-03-24 14:00:52 +00:00
deprecated.php Deprecate sticky_class() in favor of post_class(). props solarissmoke, fixes #16675. 2012-07-09 21:10:59 +00:00
feed-atom-comments.php Use get_search_query() in feed-rss2-comments.php. Props SergeyBiryukov. fixes #21365 2012-07-25 18:04:17 +00:00
feed-atom.php Use html_type for alternate link elements in atom feeds, as done in atom comment feeds. props niallkennedy. fixes #21305. 2012-07-20 15:08:45 +00:00
feed-rdf.php
feed-rss2-comments.php Use get_search_query() in feed-rss2-comments.php. Props SergeyBiryukov. fixes #21365 2012-07-25 18:04:17 +00:00
feed-rss2.php Use the_content_feed() when looking for zero-length post content for RSS2 feeds. Now you can have blank posts with content generated by the_content filters. props SergeyBiryukov. fixes #15604 2012-07-09 03:33:01 +00:00
feed-rss.php Use the site's locale for the feed language. Provides the same result as language_attributes(). Removes the rss_language option. fixes #13440. see #5517. 2012-01-29 19:56:33 +00:00
feed.php Supply the missing @return doc for get_the_content_feed(). props c3mdigital. fixes #21148 2012-07-09 04:51:00 +00:00
formatting.php Only run stripslashes() in stripslashes_deep() for strings, not other scalar values. props Kawauso, knutsp. props coffee2code for [UT698]. fixes #18026. 2012-07-20 15:14:26 +00:00
functions.php switch_to_blog() and restore_current_blog() housekeeping. 2012-08-09 16:28:15 +00:00
functions.wp-scripts.php User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302 2012-01-05 20:50:54 +00:00
functions.wp-styles.php User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302 2012-01-05 20:50:54 +00:00
general-template.php Move get_current_blog_id() to load.php so it is available during multisite bootstrap. fixes #21432 2012-08-09 13:17:14 +00:00
http.php API for allowing cross origin resource sharing. 2012-05-15 18:46:03 +00:00
kses.php Don't allow unfiltered HTML comments from a frame. Props nacin. fixes #20812 2012-06-01 20:47:08 +00:00
l10n.php Load the admin MO file on repair.php. props SergeyBiryukov. see #21039 for trunk. 2012-06-25 20:00:31 +00:00
link-template.php Deprecate get_blog_option(), add_blog_option(), update_blog_option(), and delete_blog_option(). 2012-08-03 17:51:42 +00:00
load.php Move get_current_blog_id() to load.php so it is available during multisite bootstrap. fixes #21432 2012-08-09 13:17:14 +00:00
locale.php Add a translator's comment. see #19924. 2012-02-06 19:43:26 +00:00
media.php Introduce wp_oembed_remove_provider(). Props r-a-y. fixes #16327 2012-07-26 20:18:27 +00:00
meta.php Add NOT EXISTS to meta queries, allowing you to query for the non-existence of a meta key. 2012-06-29 19:59:29 +00:00
ms-blogs.php switch_to_blog() and restore_current_blog() housekeeping. 2012-08-09 16:28:15 +00:00
ms-default-constants.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
ms-default-filters.php Multisite: Make it easy to replace or augment the over-quota message displayed when you try and upload new media and you have reached your quota. 2012-07-10 13:33:44 +00:00
ms-deprecated.php Undeprecate *_blog_option() by popular demand. Put them back in ms-blogs.php since direct inclusion of ms-blogs.php/ms-functions.php is unforntunately common. 2012-08-08 17:11:15 +00:00
ms-files.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
ms-functions.php Move most instances of new WP_User to get_userdata(). see #21120. 2012-08-03 01:06:05 +00:00
ms-load.php Introduce wp_load_translations_early(), which can be used before the locale is properly loaded in order to translate early error strings. Internationalize setup-config.php -- translators no longer have a reason to modify this file. fixes #18180. 2012-01-26 20:34:27 +00:00
ms-settings.php switch_to_blog() and restore_current_blog() housekeeping. 2012-08-09 16:28:15 +00:00
nav-menu-template.php Remove unused global reference. props ampt. fixes #20863. 2012-07-09 19:48:04 +00:00
nav-menu.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
option.php Call filters for default option values only as needed to reduce number of filter calls. Props Ott042. see #20448 2012-05-14 17:00:13 +00:00
pluggable-deprecated.php Update @deprecated. Props scribu. see #18333 2011-08-05 18:44:43 +00:00
pluggable.php Move most instances of new WP_User to get_userdata(). see #21120. 2012-08-03 01:06:05 +00:00
plugin.php Revert [21287] until #21169 goes through. see #21321. 2012-07-21 20:24:21 +00:00
post-template.php Fix some spelling errors. Props thee17. fixes #21191 2012-07-25 18:06:13 +00:00
post-thumbnail-template.php Add $wp_query parameter to update_post_thumbnail_cache(). props scribu. see #19949, fixes that ticket for 3.4. 2012-04-30 15:55:57 +00:00
post.php Remove unused arguments (hierarchical, _edit_link, capability_type) from register_post_status 2012-07-22 08:45:35 +00:00
query.php Use is_main_query() method, rather than the function. Only decode the search query variable if we are executing the main query and it came from the /search/ base, rather than the query string. fixes #13961. 2012-07-09 17:28:55 +00:00
registration-functions.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
registration.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
rewrite.php Set $walk_dirs = true for post rewrite rule generation. See #21020 for trunk. 2012-06-25 20:41:14 +00:00
rss-functions.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
rss.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
script-loader.php Fix the plupload script enqueue, props SergeyBiryukov, Fixes #21467. See #20683. 2012-08-05 12:16:16 +00:00
shortcodes.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
taxonomy.php Consolodate some strings. Props pavelevap. fixes #20809 2012-06-01 19:05:30 +00:00
template-loader.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
template.php Remove reference to a global eliminated long ago. props tamlyn, fixes #20668. 2012-05-24 07:06:13 +00:00
theme.php Allow switch_theme() to take a single $stylesheet argument. 2012-06-26 05:21:04 +00:00
update.php Fix string offset PHP 5.4 error by normalizing $user_count to always be an integer. props ericmann. see #20966 for trunk. 2012-06-25 19:40:16 +00:00
user.php Move most instances of new WP_User to get_userdata(). see #21120. 2012-08-03 01:06:05 +00:00
vars.php TinyMCE: better exclusion of Opera mobile, fixes #21416 2012-07-30 19:40:52 +00:00
version.php Compress scripts/styles: 3.5-alpha-21466. 2012-08-06 22:58:30 +00:00
widgets.php One newline is enough. 2012-01-05 20:10:39 +00:00
wlwmanifest.xml Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00
wp-db.php Declare, document, and protect $dbuser, $dbpassword, $dbname, $dbhost and $dbh in wpdb. 2012-08-08 06:28:57 +00:00
wp-diff.php Lose EOF ?>. Clean up EOF newlines. fixes #12307 2012-01-08 17:01:11 +00:00