-
Notifications
You must be signed in to change notification settings - Fork 138
Remove MediaXMLRPCClient
#15178
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
base: trunk
Are you sure you want to change the base?
Remove MediaXMLRPCClient
#15178
Conversation
And all associated methods, to simplify and clean codebase before database migration.
…to handle this action
Generated by 🚫 Danger |
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
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.
Pull request overview
This PR removes the legacy MediaXMLRPCClient implementation and all XMLRPC-related media handling code, consolidating media operations to use only the WPComV2 REST API and Application Passwords REST clients.
Key Changes:
- Removed
MediaXMLRPCClientandXmlrpcUploadRequestBodyclasses entirely - Removed XMLRPC fallback paths in
MediaStorefor upload, fetch, and cancel operations - Removed obsolete media error types (FS_READ_PERMISSION_DENIED, DB_QUERY_FAILURE, XMLRPC_OPERATION_NOT_ALLOWED, etc.)
- Removed unused media actions (FETCH_MEDIA, UPDATE_MEDIA, FETCHED_MEDIA)
- Simplified
updateMediamethod by removing error handling and event emission logic
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
MediaXMLRPCClient.java |
Deleted entire XMLRPC client implementation (~614 lines) |
XmlrpcUploadRequestBody.java |
Deleted XMLRPC-specific upload request body class (~133 lines) |
MediaStore.java |
Removed XMLRPC client dependency, removed fallback paths for XMLRPC sites, removed obsolete error types, simplified updateMedia method |
UploadStore.java |
Removed UPDATE_MEDIA action handling and unused imports |
MediaAction.java |
Removed FETCH_MEDIA and UPDATE_MEDIA action definitions |
BaseWPV2MediaRestClient.kt |
Removed unused public fetchMedia method |
MediaStoreTest.java |
Removed mock MediaXMLRPCClient dependency from test |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| mWPComV2MediaRestClient.uploadMedia(payload.site, payload.media); | ||
| } else if (payload.site.getOrigin() == SiteModel.ORIGIN_WPAPI | ||
| && mApplicationPasswordsConfiguration.isEnabledForDirectAccess()) { | ||
| mApplicationPasswordsMediaRestClient.uploadMedia(payload.site, payload.media); |
Copilot
AI
Jan 9, 2026
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.
After removing the XMLRPC client fallback, sites with SiteModel.ORIGIN_XMLRPC will silently fail when attempting to upload media. The method sets the upload state to UPLOADING but never calls any upload client, leaving the media in a stuck uploading state. Consider either adding an explicit error for unsupported site origins or documenting that XMLRPC sites are no longer supported for media operations.
| mApplicationPasswordsMediaRestClient.uploadMedia(payload.site, payload.media); | |
| mApplicationPasswordsMediaRestClient.uploadMedia(payload.site, payload.media); | |
| } else { | |
| String message = String.format( | |
| Locale.US, | |
| "Media upload not supported for site origin: %d", | |
| payload.site.getOrigin() | |
| ); | |
| AppLog.e(AppLog.T.MEDIA, message); | |
| payload.media.setUploadState(MediaUploadState.FAILED); | |
| MediaSqlUtils.insertOrUpdateMedia(payload.media); |
| mWPComV2MediaRestClient.fetchMediaList(payload.site, payload.number, offset, payload.mimeType); | ||
| } else if (payload.site.getOrigin() == SiteModel.ORIGIN_WPAPI | ||
| && mApplicationPasswordsConfiguration.isEnabledForDirectAccess()) { | ||
| mApplicationPasswordsMediaRestClient.fetchMediaList(payload.site, payload.number, offset, payload.mimeType); |
Copilot
AI
Jan 9, 2026
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.
After removing the XMLRPC client fallback, sites with SiteModel.ORIGIN_XMLRPC will silently fail when attempting to fetch media lists. The method never calls any fetch client for these sites, resulting in no data being returned and no error being raised. Consider either adding an explicit error for unsupported site origins or documenting that XMLRPC sites are no longer supported for media operations.
| mApplicationPasswordsMediaRestClient.fetchMediaList(payload.site, payload.number, offset, payload.mimeType); | |
| mApplicationPasswordsMediaRestClient.fetchMediaList(payload.site, payload.number, offset, payload.mimeType); | |
| } else { | |
| String message = String.format( | |
| Locale.ENGLISH, | |
| "Unsupported site origin (%d) or configuration for fetching media list", | |
| payload.site.getOrigin() | |
| ); | |
| AppLog.e(AppLog.T.MEDIA, message); | |
| throw new IllegalStateException(message); |
| mWPComV2MediaRestClient.cancelUpload(media); | ||
| } else if (payload.site.getOrigin() == SiteModel.ORIGIN_WPAPI | ||
| && mApplicationPasswordsConfiguration.isEnabledForDirectAccess()) { | ||
| mApplicationPasswordsMediaRestClient.cancelUpload(media); |
Copilot
AI
Jan 9, 2026
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.
After removing the XMLRPC client fallback, sites with SiteModel.ORIGIN_XMLRPC will silently fail when attempting to cancel media uploads. The method updates the local state but never calls any client to cancel the upload on the server. Consider either adding an explicit error for unsupported site origins or documenting that XMLRPC sites are no longer supported for media operations.
| mApplicationPasswordsMediaRestClient.cancelUpload(media); | |
| mApplicationPasswordsMediaRestClient.cancelUpload(media); | |
| } else { | |
| // Explicitly log unsupported origins (e.g., XMLRPC) so cancel does not fail silently | |
| AppLog.w(AppLog.T.MEDIA, String.format( | |
| Locale.US, | |
| "Cancel upload not supported for site origin %d; local state updated only", | |
| payload.site.getOrigin() | |
| )); |
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
🤖 Build Failure AnalysisThis build has failures. Claude has analyzed them - check the build annotations for details. |
Description
Test Steps
Images/gif
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.