Skip to content

Update theme updates UI#498

Merged
sorinmarta merged 6 commits into
masterfrom
fix-350
May 19, 2026
Merged

Update theme updates UI#498
sorinmarta merged 6 commits into
masterfrom
fix-350

Conversation

@sorinmarta
Copy link
Copy Markdown
Contributor

fixes https://github.com/Strategy11/business-directory-premium/issues/350

This PR updates the UI so that the update button is visible again and fixes the download process for the thems

@sorinmarta sorinmarta marked this pull request as ready for review May 19, 2026 08:17
@sorinmarta sorinmarta added the run analysis Runs phpcs and phpunit label May 19, 2026
@sorinmarta sorinmarta requested a review from Copilot May 19, 2026 08:17
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 addresses a regression in the admin Themes update flow by restoring the visibility of the “Update now” UI and making theme package downloads more robust (including fallback retrieval of package URLs).

Changes:

  • Adds wpbdp-inline-notice to the theme update notice markup so the update UI is visible again.
  • Ensures version info returned by the licensing layer exposes a download_link (mapped from package) to support theme downloads.
  • Refactors the theme update process to derive a download URL more reliably, download the package, validate it’s a ZIP, and then install via the Themes API.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
templates/admin/themes-item.tpl.php Adjusts theme update notice classes to restore update UI visibility.
includes/licensing.php Adds download_link to update payloads (mapped from package) for downstream consumers.
includes/admin/controllers/class-themes-admin.php Implements download URL retrieval + ZIP validation and updates the theme update/install flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread includes/admin/controllers/class-themes-admin.php
Comment thread includes/admin/controllers/class-themes-admin.php
Comment thread includes/admin/controllers/class-themes-admin.php
Comment thread includes/admin/controllers/class-themes-admin.php
@sorinmarta sorinmarta merged commit 6c2d9c5 into master May 19, 2026
4 checks passed
@sorinmarta sorinmarta deleted the fix-350 branch May 19, 2026 08:22
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Review Change Stack

Warning

Rate limit exceeded

@sorinmarta has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 11 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b7eb5746-bf84-41ec-9084-76b649943d7f

📥 Commits

Reviewing files that changed from the base of the PR and between 95d06db and 9873dc4.

📒 Files selected for processing (1)
  • includes/admin/controllers/class-themes-admin.php

Walkthrough

This PR refactors the theme update mechanism to streamline package download and installation. It introduces EDD API integration for resolving package URLs, adds ZIP validation before installation, simplifies the update flow by delegating to WordPress theme installers, and updates the licensing API response to include download links. The update notice styling is also enhanced with additional CSS classes.

Changes

Theme Update Flow Refactoring

Layer / File(s) Summary
Licensing API Response with Download Link
includes/licensing.php
WPBDP_Licensing::prepare_api_response() now conditionally sets expires (or empty string) and adds a new download_link field from $addon->package for each matched add-on, providing the package URL data needed by the theme admin.
Theme Package URL Resolution Helpers
includes/admin/controllers/class-themes-admin.php (lines 362–436)
New private helper methods compute package download URL from cached version info or query the EDD API using stored license keys; both return an empty string on failure to serve as fallback sources for the package URL.
ZIP Download and Validation Utilities
includes/admin/controllers/class-themes-admin.php (lines 525–572)
Private utility methods download a package URL via download_url() and validate the file by checking ZIP magic bytes (PK); returns a temporary file path on success, WP_Error, or false for invalid ZIPs.
Refactored Theme Update Implementation
includes/admin/controllers/class-themes-admin.php (lines 491–523)
run_update now resolves package URL using the helper methods, fails early if no URL is available, downloads and validates the ZIP, retries with a freshly fetched URL on failure, delegates installation to $this->api->install_theme(), and cleans up the archive; replaces the previous manual unpack-and-move workflow.
Theme Update Notice Styling
templates/admin/themes-item.tpl.php
Theme-update notice <div> gains additional CSS classes (wpbdp-inline-notice and notice-alt) for improved visual presentation while preserving all other attributes and content.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Update theme updates UI' is vague and overly broad. While it mentions theme updates and UI, it does not clearly convey the specific changes: the refactored update flow, ZIP validation, EDD API integration, and download handling improvements. Consider a more specific title that captures the main change, such as 'Refactor theme update flow with ZIP validation and EDD API integration' or 'Fix theme update download process and UI visibility'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description is related to the changeset, referencing the issue #350 and mentioning updates to the UI and theme download process, which align with the actual changes made.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-350

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run analysis Runs phpcs and phpunit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants