Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/wp-admin/includes/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,9 @@ function delete_plugins( $plugins, $deprecated = '' ) {
return new WP_Error( 'could_not_remove_plugin', sprintf( $message, implode( ', ', $errors ) ) );
}

// Force refresh of plugin update information.
wp_clean_plugins_cache();

return true;
}

Expand Down
16 changes: 16 additions & 0 deletions tests/phpunit/tests/ajax/wpAjaxDeletePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ public function test_invalid_file() {
* @group ms-excluded
*
* @covers ::delete_plugins
*
* @ticket 64568
*/
public function test_delete_plugin() {
$this->_setRole( 'administrator' );
Expand All @@ -139,6 +141,17 @@ public function test_delete_plugin() {
$_POST['plugin'] = 'foo.php';
$_POST['slug'] = 'foo';

// Adds the plugin cache.
$plugins_cache = array(
'' => array(
'foo.php' => array(
'Name' => 'Foo Plugin',
'Version' => '1.0',
),
),
);
wp_cache_set( 'plugins', $plugins_cache, 'plugins' );

// Make the request.
try {
$this->_handleAjax( 'delete-plugin' );
Expand All @@ -160,5 +173,8 @@ public function test_delete_plugin() {
);

$this->assertSameSets( $expected, $response );

// Verify that wp_clean_plugins_cache() was called and cleared both cache and transient.
$this->assertFalse( wp_cache_get( 'plugins', 'plugins' ), 'Plugins cache should be cleared after delete_plugins()' );
}
}
Loading