Commit Graph

59 Commits

Author SHA1 Message Date
Andrew Nacin
7554176da0 Return esc_url_raw(), not esc_url(), from get_blogaddress_by_domain(). props tlovett1, fixes #25057. #wcpvd
Built from https://develop.svn.wordpress.org/trunk@25033


git-svn-id: http://core.svn.wordpress.org/trunk@25020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-16 19:42:09 +00:00
Sergey Biryukov
0d8d513a8d Fix typo in phpdoc. props belloswan. fixes #24217.
git-svn-id: http://core.svn.wordpress.org/trunk@24124 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-29 12:49:33 +00:00
Ryan Boren
0f304375f9 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: http://core.svn.wordpress.org/trunk@23794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-25 09:29:58 +00:00
Ryan Boren
57b2fc1c04 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: http://core.svn.wordpress.org/trunk@23752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-19 05:05:19 +00:00
Peter Westwood
ffe2292a8f 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: http://core.svn.wordpress.org/trunk@23686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-13 16:00:38 +00:00
Sergey Biryukov
69bd474ac6 Remove unused global reference. props aaroncampbell. fixes #23541.
git-svn-id: http://core.svn.wordpress.org/trunk@23458 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-20 00:18:15 +00:00
Helen Hou-Sandí
b1f1579604 its <=> it's in documentation, along with a rogue the, The, and looses. props trepmal. fixes #22665.
git-svn-id: http://core.svn.wordpress.org/trunk@23191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-20 15:55:32 +00:00
Ryan Boren
06ee370814 Pinking shears
git-svn-id: http://core.svn.wordpress.org/trunk@22634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-17 15:11:29 +00:00
Ryan Boren
05c40b9926 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: http://core.svn.wordpress.org/trunk@22185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-11 12:37:46 +00:00
Ryan Boren
7a86de87fb Reduce use of global. Use get_blog_details() instead. fixes #22090
git-svn-id: http://core.svn.wordpress.org/trunk@22108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-04 12:40:09 +00:00
Ryan Boren
9fc9d42d0a * 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: http://core.svn.wordpress.org/trunk@22092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-01 18:03:23 +00:00
Ryan Boren
75e64cface 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: http://core.svn.wordpress.org/trunk@22087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-01 14:25:31 +00:00
Ryan Boren
7915172568 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: http://core.svn.wordpress.org/trunk@22015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-26 17:02:44 +00:00
Ryan Boren
c57b0f836f * 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: http://core.svn.wordpress.org/trunk@21979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-24 19:31:37 +00:00
Ryan Boren
1c44b15e63 Restore blog_option_* filter. see #21459
git-svn-id: http://core.svn.wordpress.org/trunk@21595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-23 16:04:39 +00:00
Ryan Boren
f11317881a Resurrect the switched global. Some are still using it. see #21459
git-svn-id: http://core.svn.wordpress.org/trunk@21581 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-22 03:34:00 +00:00
Ryan Boren
9cf4306b6d s/is_ms_switched/ms_is_switched/ see #21459
git-svn-id: http://core.svn.wordpress.org/trunk@21561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-20 20:56:34 +00:00
Ryan Boren
21782ca444 Introduce is_ms_switched(). see #21459
git-svn-id: http://core.svn.wordpress.org/trunk@21560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-20 20:48:35 +00:00
Ryan Boren
411714ad68 Fix phpdoc for switch_to_blog() and restore_current_blog(). Props SergeyBiryukov. fixes #21459
git-svn-id: http://core.svn.wordpress.org/trunk@21523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-15 15:56:14 +00:00
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
ryan
87dc511c0f 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: http://core.svn.wordpress.org/trunk@21480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-08 17:11:15 +00:00
ryan
5ca54e7d2f 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: http://core.svn.wordpress.org/trunk@21414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-03 17:51:42 +00:00
ryan
295ca4d76f 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: http://core.svn.wordpress.org/trunk@21403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-02 18:31:14 +00:00
ryan
af18fc1ae2 Use Yoda conditions. Props evansolomon. see #21270
git-svn-id: http://core.svn.wordpress.org/trunk@21378 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-31 21:11:17 +00:00
ryan
e75d8f7d9e 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: http://core.svn.wordpress.org/trunk@21357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-27 14:57:32 +00:00
ryan
f86bf75b34 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: http://svn.automattic.com/wordpress/trunk@20461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-13 17:30:37 +00:00
ryan
3975e5e0d2 Add refresh_blog_details action. Props mdawaffe. fixes #19987
git-svn-id: http://svn.automattic.com/wordpress/trunk@19889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-09 19:53:53 +00:00
ryan
e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +00:00
ryan
eb835e1901 Update the blog date whenever a pubic post type is published or changed after being published. fixes #18624
git-svn-id: http://svn.automattic.com/wordpress/trunk@19129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-03 17:06:45 +00:00
nacin
feb2ba5831 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: http://svn.automattic.com/wordpress/trunk@18662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-11 18:53:09 +00:00
ryan
c7e870877c Use update_blog_details() in wpmu_update_blogs_date(). Props jakub.tyrcha. fixes #18122
git-svn-id: http://svn.automattic.com/wordpress/trunk@18601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-25 18:01:49 +00:00
nacin
d96d3a74b8 Single quotes and spaces in ms-blogs.php. props niallkennedy, fixes #17522.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-22 22:19:36 +00:00
ryan
4e7270ab6a Revert [16987]. This pollutes home and siteurl during signup and blog creation. see #14867
git-svn-id: http://svn.automattic.com/wordpress/trunk@17005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-16 19:48:00 +00:00
nacin
0b1b0f86ab Add scheme arguments to get_blogaddress_by_domain and get_blogaddress_by_id. props adambackstrom for initial patch, fixes #14867.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-16 07:58:57 +00:00
nacin
844636bf1c Don't show extra .0 in _deprecated_argument calls. They should appear in @since docs though.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-15 11:27:38 +00:00
ryan
3949ce12d0 Pink trailing whites.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-13 21:21:50 +00:00
ryan
071c5dff0d Remove stripslashes(). No longer needed. Props RogerTheriault. fixes #12560
git-svn-id: http://svn.automattic.com/wordpress/trunk@16808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-08 19:25:18 +00:00
ryan
0eeb985ef2 Deprecate and ignore the refresh arg. fixes #15605
git-svn-id: http://svn.automattic.com/wordpress/trunk@16673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-01 22:12:09 +00:00
ryan
6dc6d9892f Revert [16359]. Deal with it in 3.2. see #15361
git-svn-id: http://svn.automattic.com/wordpress/trunk@16597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-26 21:38:38 +00:00
nacin
b8ce0261df More param fixes, props duck_. see #14783.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-18 19:12:48 +00:00
scribu
5f0adf4d70 Use wp_start_object_cache() in switch_to_blog(). Props prettyboymp. Fixes #15361
git-svn-id: http://svn.automattic.com/wordpress/trunk@16359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-13 23:11:50 +00:00
nacin
5e1184aa57 Pinking shears.
git-svn-id: http://svn.automattic.com/wordpress/trunk@15843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-10-19 07:48:22 +00:00
ryan
72a9626c15 Allow flagging of a blog as mature via a URL. Move some actions into update_blog_status(). Props Viper007Bond. fixes #14385
git-svn-id: http://svn.automattic.com/wordpress/trunk@15836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-10-18 18:53:47 +00:00
nacin
b7bacd1bf2 s/Wether/Whether/
git-svn-id: http://svn.automattic.com/wordpress/trunk@15756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-10-08 02:35:06 +00:00
scribu
a4167676ea Add inline documentation for ms-blogs.php. See #14953
git-svn-id: http://svn.automattic.com/wordpress/trunk@15676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-10-01 01:32:31 +00:00
ryan
5f30d3e9a0 Add user_meta to global groups. see #14475
git-svn-id: http://svn.automattic.com/wordpress/trunk@15482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-07-30 21:30:06 +00:00
ryan
9a032e6eef Fix inverted logic in [15331]. see #13934
git-svn-id: http://svn.automattic.com/wordpress/trunk@15332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-06-25 16:17:33 +00:00
ryan
6c31f32be1 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: http://svn.automattic.com/wordpress/trunk@15331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-06-25 16:16:06 +00:00
ryan
81e213c211 Use get_current_user() and get_current_user_id() instead of global . Props filofo. see #13934 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@15315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-06-24 15:01:29 +00:00
ryan
76036b069b Deprecate get_most_active_blogs() and get_blog_list(). Props ocean90. fixes #13773
git-svn-id: http://svn.automattic.com/wordpress/trunk@15168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-06-08 13:00:09 +00:00