Commit Graph

57 Commits

Author SHA1 Message Date
Ryan Boren 315f606306 Fire the update_blog_public action from update_blog_status() instead of update_blog_public(). Pass blog ID and value to the action.
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: https://develop.svn.wordpress.org/trunk@23794 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-25 09:29:58 +00:00
Ryan Boren 806002166b In refresh_blog_details(), make sure clean_blog_cache() gets the blog ID when the blog has been previously cached as non-existent. This ensures that -1 values in blog-details are cleared after blogs are created.
Props beezeee, hirozed
fixes #23405


git-svn-id: https://develop.svn.wordpress.org/trunk@23752 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-19 05:05:19 +00:00
Peter Westwood 7e33770010 Multisite: Ensure that get_blogaddress_by_name does not mangle blognames with leading digits.
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: https://develop.svn.wordpress.org/trunk@23686 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-13 16:00:38 +00:00
Sergey Biryukov 74825282e5 Remove unused global reference. props aaroncampbell. fixes #23541.
git-svn-id: https://develop.svn.wordpress.org/trunk@23458 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-20 00:18:15 +00:00
Helen Hou-Sandi 1303e7377a its <=> it's in documentation, along with a rogue the, The, and looses. props trepmal. fixes #22665.
git-svn-id: https://develop.svn.wordpress.org/trunk@23191 602fd350-edb4-49c9-b593-d223f7449a82
2012-12-20 15:55:32 +00:00
Ryan Boren 6d8bce688f Pinking shears
git-svn-id: https://develop.svn.wordpress.org/trunk@22634 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-17 15:11:29 +00:00
Ryan Boren bcbfb2c8e9 Sync actions between update_blog_details() and update_blog_status(). Add make_delete_blog and make_undelete_blog actions.
Props Kyrylo, wonderboymusic
fixes #20305


git-svn-id: https://develop.svn.wordpress.org/trunk@22185 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-11 12:37:46 +00:00
Ryan Boren 1b3f54d73d Reduce use of global. Use get_blog_details() instead. fixes #22090
git-svn-id: https://develop.svn.wordpress.org/trunk@22108 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-04 12:40:09 +00:00
Ryan Boren 42cfdfb614 * Register blog-id-cache group as global
* 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: https://develop.svn.wordpress.org/trunk@22092 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-01 18:03:23 +00:00
Ryan Boren b15d893ed8 Reinit roles and the current user after switching the cache to the new blog in switch_to_blog() and restore_current_blog(). Props joostdekeijzer. fixes #21459
git-svn-id: https://develop.svn.wordpress.org/trunk@22087 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-01 14:25:31 +00:00
Ryan Boren 8628f13d69 Don't read from the switched global. Instead use _wp_switched_stack. switched is retained for back compat and should not be directly read since it is prone to stompage by plugins. see #21459
git-svn-id: https://develop.svn.wordpress.org/trunk@22015 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-26 17:02:44 +00:00
Ryan Boren 411e1819b6 * Invalidate the get_id_from_blogname_* cache in refresh_blog_details()
* 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: https://develop.svn.wordpress.org/trunk@21979 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-24 19:31:37 +00:00
Ryan Boren e49b0dd8ea Restore blog_option_* filter. see #21459
git-svn-id: https://develop.svn.wordpress.org/trunk@21595 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-23 16:04:39 +00:00
Ryan Boren f6e6eece0c Resurrect the switched global. Some are still using it. see #21459
git-svn-id: https://develop.svn.wordpress.org/trunk@21581 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-22 03:34:00 +00:00
Ryan Boren 938c5f2fc3 s/is_ms_switched/ms_is_switched/ see #21459
git-svn-id: https://develop.svn.wordpress.org/trunk@21561 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-20 20:56:34 +00:00
Ryan Boren 54619803b0 Introduce is_ms_switched(). see #21459
git-svn-id: https://develop.svn.wordpress.org/trunk@21560 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-20 20:48:35 +00:00
Ryan Boren 67fb26f7b2 Fix phpdoc for switch_to_blog() and restore_current_blog(). Props SergeyBiryukov. fixes #21459
git-svn-id: https://develop.svn.wordpress.org/trunk@21523 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-15 15:56:14 +00:00
Ryan Boren 20a1def1c0 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: https://develop.svn.wordpress.org/trunk@21485 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-09 16:28:15 +00:00
Ryan Boren 4c0121178b 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.
see #21432


git-svn-id: https://develop.svn.wordpress.org/trunk@21480 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-08 17:11:15 +00:00
Ryan Boren ce960f67a0 Deprecate get_blog_option(), add_blog_option(), update_blog_option(), and delete_blog_option().
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: https://develop.svn.wordpress.org/trunk@21414 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-03 17:51:42 +00:00
Ryan Boren 691425a3ff 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.
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: https://develop.svn.wordpress.org/trunk@21403 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-02 18:31:14 +00:00
Ryan Boren 43d668a041 Use Yoda conditions. Props evansolomon. see #21270
git-svn-id: https://develop.svn.wordpress.org/trunk@21378 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-31 21:11:17 +00:00
Ryan Boren 9b9ce59786 Refactor *_blog_option() functions to use switch_to_blog(), restore_current_blog(), and the *_option() functions. Do not use site-options for blog option caching as this duplicated info and did not properly invalidate.
Props jeremyfelt
fixes #21270


git-svn-id: https://develop.svn.wordpress.org/trunk@21357 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-27 14:57:32 +00:00
Ryan Boren 8caae7f602 Don't update a blog's last_updated time for all post deletions. Update only when published posts are deleted.
Props SergeyBiryukov
fixes #20433


git-svn-id: https://develop.svn.wordpress.org/trunk@20461 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-13 17:30:37 +00:00
Ryan Boren 49cb409b27 Add refresh_blog_details action. Props mdawaffe. fixes #19987
git-svn-id: https://develop.svn.wordpress.org/trunk@19889 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-09 19:53:53 +00:00
Ryan Boren 2b186b0c45 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: https://develop.svn.wordpress.org/trunk@19712 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-08 17:01:11 +00:00
Ryan Boren ccaca0274d Update the blog date whenever a pubic post type is published or changed after being published. fixes #18624
git-svn-id: https://develop.svn.wordpress.org/trunk@19129 602fd350-edb4-49c9-b593-d223f7449a82
2011-11-03 17:06:45 +00:00
Andrew Nacin 598184f98c Allow get_blog_option(null,...) to hit the cache for the current blog. New return values for add_blog_option, update_blog_option, delete_blog_option. Don't set the cache in those functions if add/update/delete_option failed. see #17883.
git-svn-id: https://develop.svn.wordpress.org/trunk@18662 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-11 18:53:09 +00:00
Ryan Boren 51f1d1adf0 Use update_blog_details() in wpmu_update_blogs_date(). Props jakub.tyrcha. fixes #18122
git-svn-id: https://develop.svn.wordpress.org/trunk@18601 602fd350-edb4-49c9-b593-d223f7449a82
2011-08-25 18:01:49 +00:00
Andrew Nacin 83d40f657b Single quotes and spaces in ms-blogs.php. props niallkennedy, fixes #17522.
git-svn-id: https://develop.svn.wordpress.org/trunk@17988 602fd350-edb4-49c9-b593-d223f7449a82
2011-05-22 22:19:36 +00:00
Ryan Boren d56880f092 Revert [16987]. This pollutes home and siteurl during signup and blog creation. see #14867
git-svn-id: https://develop.svn.wordpress.org/trunk@17005 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-16 19:48:00 +00:00
Andrew Nacin 8c7a9647fc Add scheme arguments to get_blogaddress_by_domain and get_blogaddress_by_id. props adambackstrom for initial patch, fixes #14867.
git-svn-id: https://develop.svn.wordpress.org/trunk@16987 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-16 07:58:57 +00:00
Andrew Nacin 4904a251a5 Don't show extra .0 in _deprecated_argument calls. They should appear in @since docs though.
git-svn-id: https://develop.svn.wordpress.org/trunk@16938 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-15 11:27:38 +00:00
Ryan Boren 6dc2d07bc4 Pink trailing whites.
git-svn-id: https://develop.svn.wordpress.org/trunk@16900 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-13 21:21:50 +00:00
Ryan Boren 7cefd23188 Remove stripslashes(). No longer needed. Props RogerTheriault. fixes #12560
git-svn-id: https://develop.svn.wordpress.org/trunk@16808 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-08 19:25:18 +00:00
Ryan Boren 14a1be89f6 Deprecate and ignore the refresh arg. fixes #15605
git-svn-id: https://develop.svn.wordpress.org/trunk@16673 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-01 22:12:09 +00:00
Ryan Boren 44cb0591a1 Revert [16359]. Deal with it in 3.2. see #15361
git-svn-id: https://develop.svn.wordpress.org/trunk@16597 602fd350-edb4-49c9-b593-d223f7449a82
2010-11-26 21:38:38 +00:00
Andrew Nacin ccea27cbe7 More param fixes, props duck_. see #14783.
git-svn-id: https://develop.svn.wordpress.org/trunk@16469 602fd350-edb4-49c9-b593-d223f7449a82
2010-11-18 19:12:48 +00:00
scribu cf7f2d92b4 Use wp_start_object_cache() in switch_to_blog(). Props prettyboymp. Fixes #15361
git-svn-id: https://develop.svn.wordpress.org/trunk@16359 602fd350-edb4-49c9-b593-d223f7449a82
2010-11-13 23:11:50 +00:00
Andrew Nacin fb4e38b0e7 Pinking shears.
git-svn-id: https://develop.svn.wordpress.org/trunk@15843 602fd350-edb4-49c9-b593-d223f7449a82
2010-10-19 07:48:22 +00:00
Ryan Boren 122a2981c4 Allow flagging of a blog as mature via a URL. Move some actions into update_blog_status(). Props Viper007Bond. fixes #14385
git-svn-id: https://develop.svn.wordpress.org/trunk@15836 602fd350-edb4-49c9-b593-d223f7449a82
2010-10-18 18:53:47 +00:00
Andrew Nacin a1cd90933d s/Wether/Whether/
git-svn-id: https://develop.svn.wordpress.org/trunk@15756 602fd350-edb4-49c9-b593-d223f7449a82
2010-10-08 02:35:06 +00:00
scribu 6dd0736429 Add inline documentation for ms-blogs.php. See #14953
git-svn-id: https://develop.svn.wordpress.org/trunk@15676 602fd350-edb4-49c9-b593-d223f7449a82
2010-10-01 01:32:31 +00:00
Ryan Boren 27806b68d9 Add user_meta to global groups. see #14475
git-svn-id: https://develop.svn.wordpress.org/trunk@15482 602fd350-edb4-49c9-b593-d223f7449a82
2010-07-30 21:30:06 +00:00
Ryan Boren 01443b68b3 Fix inverted logic in [15331]. see #13934
git-svn-id: https://develop.svn.wordpress.org/trunk@15332 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-25 16:17:33 +00:00
Ryan Boren f338e835a2 Don't perform current user ops in switch_to_blog() or restore_current_blog() if init hasn't fired. Avoids wp_get_current_user() not defined error when those functions are run before init. Ops on current user prior to init are meaningless anyway. see #13934
git-svn-id: https://develop.svn.wordpress.org/trunk@15331 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-25 16:16:06 +00:00
Ryan Boren 494ee995b5 Use get_current_user() and get_current_user_id() instead of global . Props filofo. see #13934 for trunk
git-svn-id: https://develop.svn.wordpress.org/trunk@15315 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-24 15:01:29 +00:00
Ryan Boren c7be6ba80f Deprecate get_most_active_blogs() and get_blog_list(). Props ocean90. fixes #13773
git-svn-id: https://develop.svn.wordpress.org/trunk@15168 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-08 13:00:09 +00:00
Ron Rennick cff1c00885 use network_home_url in get_blogaddress_by_name, see #12735
git-svn-id: https://develop.svn.wordpress.org/trunk@14703 602fd350-edb4-49c9-b593-d223f7449a82
2010-05-16 22:21:06 +00:00
Ron Rennick 3f36d28e3b fix warning in r14342, see #13104
git-svn-id: https://develop.svn.wordpress.org/trunk@14351 602fd350-edb4-49c9-b593-d223f7449a82
2010-05-02 23:33:02 +00:00