Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
WP Plugins
Cron-Control
Commits
e4b0f8f7
Commit
e4b0f8f7
authored
May 26, 2017
by
Erick Hitter
Committed by
GitHub
May 26, 2017
Browse files
Merge pull request #109 from Automattic/107/ms-drop-table
Remove the plugin's table when a subsite is deleted from a multisite
parents
d04493eb
78d4c3f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/class-events-store.php
View file @
e4b0f8f7
...
...
@@ -37,6 +37,9 @@ class Events_Store extends Singleton {
add_action
(
'wp_install'
,
array
(
$this
,
'create_table_during_install'
)
);
add_action
(
'wpmu_new_blog'
,
array
(
$this
,
'create_tables_during_multisite_install'
)
);
// Remove table when a multisite subsite is deleted
add_filter
(
'wpmu_drop_tables'
,
array
(
$this
,
'remove_multisite_table'
)
);
// Enable plugin when conditions support it, otherwise limit errors as much as possible
if
(
self
::
is_installed
()
)
{
// Option interception
...
...
@@ -211,6 +214,20 @@ class Events_Store extends Singleton {
$this
->
_prepare_table
();
}
/**
* When deleting a subsite from a multisite instance, include the plugin's table
*
* Core only drops its tables
*
* @param array $tables_to_drop Array of prefixed table names to drop
* @return array
*/
public
function
remove_multisite_table
(
$tables_to_drop
)
{
$tables_to_drop
[]
=
$this
->
get_table_name
();
return
$tables_to_drop
;
}
/**
* PLUGIN FUNCTIONALITY
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment