-
Notifications
You must be signed in to change notification settings - Fork 121
Refactor PluginsService to use plugin file path for better stability #15871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…e that is more likely to change.
|
|
iamgabrielma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
| /// - Parameters: | ||
| /// - siteID: The site ID to search for the plugin. | ||
| /// - plugin: The plugin's file path (e.g., "woocommerce/woocommerce.php" for WooCommerce). | ||
| /// - isActive: Whether to wait for the plugin to be active or inactive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think the usage of "wait for" bit here could be miss leading, since we're not waiting but matching the current plugin state in storage. wdyt?
| /// - isActive: Whether to wait for the plugin to be active or inactive. | |
| /// - isActive: Whether to match a plugin that is currently active or inactive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this inaccurate comment, updated the comment in 5f83b82.
| public func waitForPluginInStorage(siteID: Int64, pluginName: String, isActive: Bool) async -> SystemPlugin { | ||
| let predicate = \StorageSystemPlugin.siteID == siteID && \StorageSystemPlugin.name == pluginName && \StorageSystemPlugin.active == isActive | ||
| let nameDescriptor = NSSortDescriptor(keyPath: \StorageSystemPlugin.name, ascending: true) | ||
| public func waitForPluginInStorage(siteID: Int64, plugin: String, isActive: Bool) async -> SystemPlugin { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: How about updating the signature to pluginPath, or similar? Just to be more explicit about what we need to pass in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, renamed in c6488a1.
…waitForPluginInStorage` to improve readability.

For WOOMOB-760
Just one review is required.
Description
Refactors the
PluginsService.waitForPluginInStoragemethod to use the stable plugin file path identifier instead of the potentially changing plugin display name. This change improves reliability when querying for plugins in storage by using the plugin's file path (e.g., "woocommerce/woocommerce.php") which is less likely to change compared to display names.The plugin file path is the stable identifier used by WordPress internally and returned by the WooCommerce REST API
/wp-json/wc/v3/system_statusendpoint in theactive_plugins.pluginfield.Steps to reproduce
Testing information
RELEASE-NOTES.txtif necessary.