WordPress/wp-admin
Felix Arntz 2b10923a28 Multisite: Introduce a site initialization and uninitialization API.
This changeset makes the new CRUD API for sites introduced in [43548] usable for real-world sites. A new function `wp_initialize_site()`, which takes care of creating a site's database tables and populating them with initial values, is hooked into the site insertion process that is initiated when calling `wp_insert_site()`. Similarly, a new function `wp_uninitialize_site()`, which takes care of dropping a site's database tables, is hooked into the site deletion process that is initiated when calling `wp_delete_site()`.

A new function `wp_is_site_initialized()` completes the API, allowing to check whether a site is initialized. Since this function always makes a database request in its default behavior, it should be called with caution. Plugins that would like to use site initialization in special ways can leverage a `pre_wp_is_site_initialized` filter to alter that default behavior.

The separate handling of the site's row in the `wp_blogs` database table and the actual site setup allows for more flexibility in controlling whether or how a site's data is set up. For example, a unit test that only checks data from the site's database table row can unhook the site initialization process to improve performance. At the same time, developers consuming the new sites API only need to know about the CRUD functions, since the initialization and uninitialization processes happen internally.

With this changeset, the foundation for a sites REST API endpoint is fully available. The previously recommended functions `wpmu_create_blog()` and `wpmu_delete_blog()` now call the new respective function internally. Further follow-up work to this includes replacing calls to `wpmu_create_blog()` with `wp_insert_site()`, `update_blog_details()` with `wp_update_site()` and `wpmu_delete_blog()` with `wp_delete_blog()` throughout the codebase.

As a side-effect of this work, the `wpmu_new_blog`, `delete_blog`, and `deleted_blog` actions and the `install_blog()` function have been deprecated.

Fixes #41333. See #40364.

Built from https://develop.svn.wordpress.org/trunk@43654


git-svn-id: http://core.svn.wordpress.org/trunk@43483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-09-24 15:09:26 +00:00
..
css Customize: Increase the colour contrast of the line numbers in CodeMirror. 2018-08-19 11:01:23 +00:00
images
includes Multisite: Introduce a site initialization and uninitialization API. 2018-09-24 15:09:26 +00:00
js Customize: Ensure that only sidebar sections are considered when comparing against sidebars. 2018-08-28 19:55:25 +00:00
maint Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
network Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
user Code is Poetry. 2017-11-30 23:11:00 +00:00
about.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
admin-ajax.php Privacy: add means to erase personal data by username or email address. First run. 2018-04-18 22:30:22 +00:00
admin-footer.php Code is Poetry. 2017-11-30 23:11:00 +00:00
admin-functions.php Code is Poetry. 2017-11-30 23:11:00 +00:00
admin-header.php Administration: Remove $title_class variable, unused since [18683]. 2018-08-19 10:18:26 +00:00
admin-post.php Code is Poetry. 2017-11-30 23:11:00 +00:00
admin.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
async-upload.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
comment.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
credits.php Help/About: Move "Get involved" link on Credits screen to the top of the page for better visibility. 2018-04-30 03:16:22 +00:00
custom-background.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
custom-header.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
customize.php General: Further improve error messages following [42648]. 2018-02-19 02:13:32 +00:00
edit-comments.php I18N: Use the actual placeholder instead of a number in translator comments if the corresponding string does not use numbered placeholders. 2018-03-11 16:44:34 +00:00
edit-form-advanced.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
edit-form-comment.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
edit-link-form.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
edit-tag-form.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
edit-tags.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
edit.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
export.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
freedoms.php Coding Standards: Prepare for upgrading WPCS to 1.0.0. 2018-08-15 06:22:26 +00:00
import.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
index.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
install-helper.php Code is Poetry. 2017-11-30 23:11:00 +00:00
install.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
link-add.php Code is Poetry. 2017-11-30 23:11:00 +00:00
link-manager.php Code is Poetry. 2017-11-30 23:11:00 +00:00
link-parse-opml.php Code is Poetry. 2017-11-30 23:11:00 +00:00
link.php Code is Poetry. 2017-11-30 23:11:00 +00:00
load-scripts.php Script loader: remove (PHP based) compression from load-styles.php and load-scripts.php. WIth the amount of scripts and stylesheets grown a lot over the years, it has become pretty slow and consumes a lot of server resources. Also, most servers are set to compress PHP output anyway. 2018-08-20 13:51:24 +00:00
load-styles.php Script loader: remove (PHP based) compression from load-styles.php and load-scripts.php. WIth the amount of scripts and stylesheets grown a lot over the years, it has become pretty slow and consumes a lot of server resources. Also, most servers are set to compress PHP output anyway. 2018-08-20 13:51:24 +00:00
media-new.php Code is Poetry. 2017-11-30 23:11:00 +00:00
media-upload.php General: Further improve error messages following [42648]. 2018-02-19 02:13:32 +00:00
media.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
menu-header.php Code is Poetry. 2017-11-30 23:11:00 +00:00
menu.php Privacy: Replace intrusive policy update notice with menu bubbles. 2018-05-10 19:52:21 +00:00
moderation.php Code is Poetry. 2017-11-30 23:11:00 +00:00
ms-admin.php
ms-delete-site.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
ms-edit.php Don't rely on include_path to include files. 2013-09-25 00:18:11 +00:00
ms-options.php Code is Poetry. 2017-11-30 23:11:00 +00:00
ms-sites.php Code is Poetry. 2017-11-30 23:11:00 +00:00
ms-themes.php Code is Poetry. 2017-11-30 23:11:00 +00:00
ms-upgrade-network.php Code is Poetry. 2017-11-30 23:11:00 +00:00
ms-users.php Code is Poetry. 2017-11-30 23:11:00 +00:00
my-sites.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
nav-menus.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
network.php Code is Poetry. 2017-11-30 23:11:00 +00:00
options-discussion.php Privacy: Revert [43525]. 2018-07-24 17:06:24 +00:00
options-general.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
options-head.php Code is Poetry. 2017-11-30 23:11:00 +00:00
options-media.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
options-permalink.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
options-reading.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
options-writing.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
options.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
plugin-editor.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
plugin-install.php Code is Poetry. 2017-11-30 23:11:00 +00:00
plugins.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
post-new.php Move scheduling of old auto-draft posts deletion to get_default_post_to_edit() (where auto-drafts are created). 2018-06-28 02:26:22 +00:00
post.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
press-this.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
privacy.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
profile.php Code is Poetry. 2017-11-30 23:11:00 +00:00
revision.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
setup-config.php Upgrade/Install: Adjust table prefix string check in setup-config.php for the coding standards change in [42343]. 2018-09-20 05:15:25 +00:00
term.php General: Further improve error messages following [42648]. 2018-02-19 02:13:32 +00:00
theme-editor.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
theme-install.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
themes.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
tools.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
update-core.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
update.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
upgrade-functions.php Code is Poetry. 2017-11-30 23:11:00 +00:00
upgrade.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
upload.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
user-edit.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
user-new.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
users.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00
widgets.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:51:36 +00:00