Opened 7 years ago
Closed 5 years ago
#7984 closed defect (bug) (fixed)
Core multisite changes require mods to BP
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.0.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Blogs | Keywords: | has-patch commit |
Cc: |
Description ¶
In preparation for 'site' support in the core REST API, WordPress has made some internal changes surrounding site creation in Multisite. See https://core.trac.wordpress.org/ticket/41333 and especially https://core.trac.wordpress.org/changeset/43654 for details. Summary:
- The new canonical way to create a site is
wp_initialize_site()
, and other methods (wpmu_create_blog()
etc) will soon be converted to wrappers and deprecated - WPMU hooks like
wpmu_new_blog
are deprecated
In the medium term, we should migrate over to the new methods, though doing this will require some WP capability sniffing. (For example, I'm not sure of an elegant way to hook to wpmu_new_blog
only if the new wp_initialize_site
hook is not available.)
In the short term, we should add deprecation notices to our automated tests so that they pass.
Commits (6)
- [12242] Tests: When tearing down test fixtures, use
wp_uninitialize_site()
if available.… by @boonebgorges 7 years ago - [12243] Tests: Add deprecation notices for
wpmu_new_blog
anddelete_blog
hook usage.… by @boonebgorges 7 years ago - [12245] Tests: More targeted 'wpmu_new_blog' deprecation notices.… by @boonebgorges 7 years ago
- [12246] Tests: Move
wpmu_new_blog
anddelete_blog
expectedDeprecated
calls into test logic.… by @boonebgorges 7 years ago - [12247] Tests: More site-creation deprecation fine-tuning.… by @boonebgorges 7 years ago
- [12606] Adapt BuddyPress to WP 5.1.0 multisite changes & deprecations… by @imath 5 years ago
Pull Requests
- Loading…
Change History (14)
#6
@
6 years ago
- Keywords needs-patch added
- Milestone changed from 4.0 to Up Next
The tests improvements will ship with 4.0, but we'll need more work to use the new functionality. Since the new functionality isn't slated to land in WP until 5.1 anyway, there's no rush.
#7
@
5 years ago
- Milestone changed from Up Next to 6.0.0
Let's try to stop using this deprecated hook when BuddyPress is activated on WordPress >= 5.1 before releasing BP 6.0.
#10
@
5 years ago
- Keywords has-patch 2nd-opinion added; needs-patch removed
Hi !
I believe now WordPress is about to publish 5.4, we should really stop using hooks that were deprecated in WordPress 5.1. That's why I'd really like us to fix this ticket.
In 7984.patch I'm introducing 2 hooks that are doing the needed compatibility stuff. I'm pretty confident about this patch as I've run successfully the unit tests (Multisite and regular configs).
The 2 new hooks are :
'bp_insert_site'
=> to mimic what was doing'wpmu_new_blog'
,'bp_delete_site'
=> to mimic what was doing'delete_blog'
.
@boonebgorges could you take a look at it soon ☺️. I'd feel more secure about committing this after you had eyes on the patch. Thanks in advance.
#11
@
5 years ago
- Keywords commit added; 2nd-opinion removed
Thanks for working on this, @imath.
It's a shame to have to introduce all of this infrastructure just so that we can support both versions without deprecation notices, when we'll probably drop support for < 5.1 in one of the next few major BP releases. Mais c'est la vie :)
I want to make the following observations clear, for the sake of posterity.
- The weird function signatures for the
bp_insert_site()
andbp_delete_site()
functions help to ensure that (a) we can accept arguments from the new WP hooks, while (b) continuing to pass the legacy arguments to our new hooks. This means less internal refactoring (eg, we don't have to rewritebp_blogs_remove_blog()
to accept WP's new filter args) as well as easier swap-outs for BP plugin developers who want to move away from WP's legacy hooks.
- The
bp_insert_site_hook()
andbp_delete_site_hook()
functions will, after we update the minimum WP version to 5.1, always return the new hook names. At that time, we may want to clarify the inline docs a bit - we probably won't be able to remove the functions altogether, but it'll be helpful for future developers to have clear explanations of this part of the codebase that is essentially temporary.
- The
bp_delete_site_no_tables_drop()
trick reflects the fact the oldwpmu_delete_blog()
function had two different users: (a) to mark a sitedeleted
in the database, or to drop the tables from the database. In WP 5.1+, the operations are separate:wp_update_site()
is used to set a site todeleted
, whilewp_delete_site()
is used to drop database tables. For compatibility with the previous behavior of thedelete_blog
hook (where BP removes its blog-related data regardless of whether we're in situation (a) or (b)) we need to have two different callbacks.
#12
@
5 years ago
Thanks a lot for your feedback and great explanations @boonebgorges 👍. I totally agree when you say "dommage mais c'est la vie". I'm going to commit the changes asap.
In 12242: