mirror of
https://github.com/WordPress/WordPress.git
synced 2024-10-01 08:37:55 +02:00
Plugins: Rename the delete_plugin
action hook (introduced in [35094]) to deleted_plugin
as it fires ''following'' a plugin deletion attempt.
Further, introduce a new `delete_plugin` action hook, to be fired ''before'' a plugin deletion attempt. Both changes bring parity with other such transactional hooks in core that fire before and after certain actions, including on plugin activation/deactivation and install/uninstall, among others. Props johnjamesjacoby. Fixes #26904. Built from https://develop.svn.wordpress.org/trunk@35669 git-svn-id: http://core.svn.wordpress.org/trunk@35633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8919d9a88a
commit
283b7d0a66
@ -816,7 +816,17 @@ function delete_plugins( $plugins, $deprecated = '' ) {
|
|||||||
uninstall_plugin($plugin_file);
|
uninstall_plugin($plugin_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires immediately before a plugin deletion attempt.
|
||||||
|
*
|
||||||
|
* @since 4.4.0
|
||||||
|
*
|
||||||
|
* @param string $plugin_file Plugin file name.
|
||||||
|
*/
|
||||||
|
do_action( 'delete_plugin', $plugin_file );
|
||||||
|
|
||||||
$this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin_file ) );
|
$this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin_file ) );
|
||||||
|
|
||||||
// If plugin is in its own directory, recursively delete the directory.
|
// If plugin is in its own directory, recursively delete the directory.
|
||||||
if ( strpos( $plugin_file, '/' ) && $this_plugin_dir != $plugins_dir ) { //base check on if plugin includes directory separator AND that it's not the root plugin folder
|
if ( strpos( $plugin_file, '/' ) && $this_plugin_dir != $plugins_dir ) { //base check on if plugin includes directory separator AND that it's not the root plugin folder
|
||||||
$deleted = $wp_filesystem->delete( $this_plugin_dir, true );
|
$deleted = $wp_filesystem->delete( $this_plugin_dir, true );
|
||||||
@ -832,7 +842,7 @@ function delete_plugins( $plugins, $deprecated = '' ) {
|
|||||||
* @param string $plugin_file Plugin file name.
|
* @param string $plugin_file Plugin file name.
|
||||||
* @param bool $deleted Whether the plugin deletion was successful.
|
* @param bool $deleted Whether the plugin deletion was successful.
|
||||||
*/
|
*/
|
||||||
do_action( 'delete_plugin', $plugin_file, $deleted );
|
do_action( 'deleted_plugin', $plugin_file, $deleted );
|
||||||
|
|
||||||
if ( ! $deleted ) {
|
if ( ! $deleted ) {
|
||||||
$errors[] = $plugin_file;
|
$errors[] = $plugin_file;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-beta4-35668';
|
$wp_version = '4.4-beta4-35669';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user