Allow WP-CLI `wp optimole media rollback_images` command to execute when `offload_media` is set to rollback state
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
Hướng nghiên cứu
Look at the WP-CLI command handler for wp optimole media rollback_images, likely in a class like Optml_Media_Offload. The validation check for the offload_media option needs to be adjusted to also allow execution when the storage mode is 'rollback'. Examine how the plugin state is stored and identify the condition that signifies an active rollback. Test the command after changes to ensure it works both when offload is enabled and during a rollback.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Impact: 75 · Confidence: 95 · Complexity: 30
Description
- Problem: When a site administrator initiates an image transfer/rollback from the plugin dashboard ('Transfer back from Optimole'), Optimole sets the plugin storage mode to rollback, which stores the
offload_mediasetting option as disabled. If the administrator or host then attempts to run the command-line rollback tool (wp optimole media rollback_images), the WP-CLI command throws an error:Error: You need to have the offload_media option enabled in order to use this commandand aborts. - Desired behavior: WP-CLI's
wp optimole media rollback_imagescommand should check whether a rollback is currently active or in progress (or allow execution ifoffload_mediais disabled due to an ongoing rollback state), rather than strictly requiringoffload_mediato be enabled. - Acceptance Criteria:
- Running
wp optimole media rollback_imagessucceeds when an image rollback operation has been initiated from the dashboard (whereoffload_mediais disabled or set to rollback mode). - The CLI command only rejects execution if no offloaded images exist or if offload media was never configured/active.
Customer Context
The customer needed to roll back 11,000+ offloaded images. The background WP-Cron process stalled due to server cron restrictions. When support instructed the customer and host to run wp optimole media rollback_images via SSH/terminal, the WP-CLI command failed because selecting 'Transfer back from Optimole' in the plugin dashboard had set offload_media to disabled.
Root Cause Analysis
The customer needed to restore offloaded media back to the local WordPress Media Library. The plugin's UI dashboard action 'Transfer back from Optimole' sets the plugin's offload storage mode to rollback, which sets the offload_media option value to disabled. When background WP-Cron stalled and support instructed the host to run wp optimole media rollback_images via WP-CLI, the CLI command failed because it enforces a strict check requiring offload_media to be enabled before initiating or resuming a rollback. The root cause is a workflow/validation contradiction in the plugin code: initiating a rollback in UI turns off offload_media, but the CLI command requires offload_media to be enabled.
Alternative Suggestions
Relax or adjust the option check in Optml_Media_Offload / WP-CLI rollback command handler so that wp optimole media rollback_images checks whether offloaded images exist or whether storage mode is in rollback state, rather than strictly asserting offload_media == enabled.
Reasoning
The customer experienced a failure running the CLI rollback command wp optimole media rollback_images because selecting 'Transfer back from Optimole' in the WordPress admin dashboard saved the storage mode as rollback, which updated offload_media option to disabled. Consequently, when attempting to run wp optimole media rollback_images via CLI as recommended for reliable or large background operations, WP-CLI halts with Error: You need to have the offload_media option enabled in order to use this command. The CLI rollback command should automatically permit execution when offload_media is in a rollback state or automatically bypass this option check during a rollback operation.
Source: HelpScout #3456031569
Generated by feature-request-triage workflow (ID: feature-request-triage_6ab502db326f90.60727165)
- Ngôn ngữ chính
- PHP
- Star
- 73
- Fork
- 14
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Codeinwp/optimole-wp
-
bug-report bug-report-triage crash-report
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 65/100
Codeinwp/optimole-wp#1162 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug-report bug-report-triage customer report regression
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 56/100
Codeinwp/optimole-wp#1159 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
customer report feature-request-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Codeinwp/optimole-wp#1151 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug-report bug-report-triage crash-report
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Codeinwp/optimole-wp#1139 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug-report bug-report-triage customer report
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Codeinwp/optimole-wp#1136 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Codeinwp/optimole-wp
Issue tương tự
-
[Bug] : Main navigation "Upcoming Events" link navigates to /events/ without query parameterĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Area] REST API [Type] Documentation Good First Issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 90/100
WordPress/presence-api#584 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100