Skip to content

Boost: Update minify garbage collection to clean up files as well #44137

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

Open
wants to merge 5 commits into
base: add/boost/minify-cleanup-HOG-189
Choose a base branch
from

Conversation

dilirity
Copy link
Member

@dilirity dilirity commented Jun 30, 2025

Caution

Merge this after #44134

Fixes HOG-190

Proposed changes:

  • Remove stale static concatenated files when running garbage collection.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

HOG-190

Does this pull request change what data or activity we track or use?

no

Testing instructions:

  • Setup Boost (free) on this branch;
  • Enable Concatenate JS/CSS;
  • Visit a couple of pages so your website generates concatenated files and serves them from boost-cache/static;
  • Now change this:

$expire_timestamp = time() + MONTH_IN_SECONDS;

to

$expire_timestamp = time() + YEAR_IN_SECONDS;

This will force garbage collection to clean up any static files that were created, as it will treat them as expired.

@dilirity dilirity self-assigned this Jun 30, 2025
@dilirity dilirity changed the base branch from trunk to add/boost/minify-cleanup-HOG-189 June 30, 2025 14:58
@github-actions github-actions bot added [Plugin] Boost A feature to speed up the site and improve performance. [Status] In Progress labels Jun 30, 2025
Copy link
Contributor

github-actions bot commented Jun 30, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Boost plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jun 30, 2025
Copy link

jp-launch-control bot commented Jun 30, 2025

Code Coverage Summary

No summary data is available for parent commit 9598f32, so cannot calculate coverage changes. 😴

If that commit is a feature branch rather than a trunk commit, this is expected. Otherwise, this should be updated once coverage for 9598f32 is available.

Full summary · PHP report · JS report

Coverage check overridden by I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. .

@dilirity dilirity added the I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. label Jun 30, 2025
@dilirity dilirity added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Status] In Progress labels Jun 30, 2025
@dilirity dilirity marked this pull request as ready for review June 30, 2025 15:12
// Since we don't have a way to know if this file is JS or CSS,
// we delete both.

$js_file_path = jetpack_boost_get_minify_file_path( $hash . '.min.js' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming here; It's not possible/extremely unlikely that there can be both a $hash.min.js, and a $hash.min.css? As if both exist, the CSS file will not be deleted

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't thought of that.

Though the hash is built from the path names of the assets and the modify time of the newest one.

I've updated this in 96338bd.

@dilirity dilirity requested a review from LiamSarsfield July 1, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. [Plugin] Boost A feature to speed up the site and improve performance. [Status] Needs Review This PR is ready for review. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants