Make WordPress Core

Opened 6 weeks ago

Last modified 5 weeks ago

#64568 new defect (bug)

get_plugins() returning stale data after delete_plugins() successfully executed

Reported by: pentatonicfunk's profile pentatonicfunk Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Plugins Keywords: has-patch changes-requested
Focuses: Cc:

Description

it seems even though plugins group cache is part of wp_cache_add_non_persistent_groups, in the example below it returns stale data because executions happens in the same runtime.

$ wp shell
wp> get_plugins()
=> array(1) {
  ["health-check/health-check.php"]=>
  array(15) {
    ["Name"]=>
    string(30) "Health Check & Troubleshooting"
    ["PluginURI"]=>
    string(43) "https://wordpress.org/plugins/health-check/"
    ["Version"]=>
    string(5) "1.7.1"
    ["Description"]=>
    string(44) "Checks the health of your WordPress install."
    ["Author"]=>
    string(27) "The WordPress.org community"
    ["AuthorURI"]=>
    string(43) "https://wordpress.org/plugins/health-check/"
    ["TextDomain"]=>
    string(12) "health-check"
    ["DomainPath"]=>
    string(0) ""
    ["Network"]=>
    bool(false)
    ["RequiresWP"]=>
    string(0) ""
    ["RequiresPHP"]=>
    string(3) "5.6"
    ["UpdateURI"]=>
    string(0) ""
    ["RequiresPlugins"]=>
    string(0) ""
    ["Title"]=>
    string(30) "Health Check & Troubleshooting"
    ["AuthorName"]=>
    string(27) "The WordPress.org community"
  }
}
wp> delete_plugins( ["health-check/health-check.php"] )
=> bool(true)
wp> get_plugins() <-- expecting health-check to be gone
=> array(1) {
  ["health-check/health-check.php"]=>
  array(15) {
    ["Name"]=>
    string(30) "Health Check & Troubleshooting"
    ["PluginURI"]=>
    string(43) "https://wordpress.org/plugins/health-check/"
    ["Version"]=>
    string(5) "1.7.1"
    ["Description"]=>
    string(44) "Checks the health of your WordPress install."
    ["Author"]=>
    string(27) "The WordPress.org community"
    ["AuthorURI"]=>
    string(43) "https://wordpress.org/plugins/health-check/"
    ["TextDomain"]=>
    string(12) "health-check"
    ["DomainPath"]=>
    string(0) ""
    ["Network"]=>
    bool(false)
    ["RequiresWP"]=>
    string(0) ""
    ["RequiresPHP"]=>
    string(3) "5.6"
    ["UpdateURI"]=>
    string(0) ""
    ["RequiresPlugins"]=>
    string(0) ""
    ["Title"]=>
    string(30) "Health Check & Troubleshooting"
    ["AuthorName"]=>
    string(27) "The WordPress.org community"
  }
}
wp>

Change History (3)

#1 @westonruter
6 weeks ago

It seems that wp_clean_plugins_cache() should be getting called after delete_plugins() runs. I don't see that this is the case.

This ticket was mentioned in PR #10843 on WordPress/wordpress-develop by @hbhalodia.


5 weeks ago
#2

  • Keywords has-patch added

#3 @mukesh27
5 weeks ago

  • Keywords changes-requested added
  • Version 6.9 deleted
Note: See TracTickets for help on using tickets.