Skip to content
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

Closes #7242 3.19 - Preload Fonts - Data insertion part #7274

Merged

Conversation

Khadreal
Copy link
Contributor

@Khadreal Khadreal commented Feb 4, 2025

Description

Add database structure and ajax for preload fonts
Fixes #7242

Type of change

  • New feature (non-breaking change which adds functionality).

Detailed scenario

N/A

Technical description

Documentation

Add 3.19 database structure, ajax controller.

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

@Khadreal Khadreal changed the base branch from develop to feature/preload-fonts February 4, 2025 07:50
Copy link

codacy-production bot commented Feb 4, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for f8142151 42.20% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (f814215) Report Missing Report Missing Report Missing
Head commit (bf19eae) 39194 17180 43.83%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7274) 109 46 42.20%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@Khadreal Khadreal marked this pull request as ready for review February 5, 2025 12:07
@Khadreal Khadreal requested a review from a team February 5, 2025 20:22
@jeawhanlee
Copy link
Contributor

@wordpressfan For preload fonts, we did agree to only store the font url in a JSON array right?

@jeawhanlee
Copy link
Contributor

@Khadreal I think we need to update the mock data in the test to be just JSON array of font urls

CC: @wordpressfan

@Mai-Saad
Copy link
Contributor

Mai-Saad commented Feb 10, 2025

@Khadreal Thanks for the PR. During exploratory can see

  • The table wasn't created after a fresh install
  • Fatal error when try to delete wpr
[10-Feb-2025 12:31:25 UTC] PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function WPRocketUninstall::__construct(), 6 passed in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/uninstall.php on line 38 and exactly 7 expected in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/inc/Engine/WPRocketUninstall.php:158
Stack trace:
#0 /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/uninstall.php(38): WPRocketUninstall->__construct()
#1 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/includes/plugin.php(1314): include_once('...')
#2 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/includes/plugin.php(970): uninstall_plugin()
#3 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/includes/ajax-actions.php(4771): delete_plugins()
#4 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(324): wp_ajax_delete_plugin()
#5 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#6 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/plugin.php(517): WP_Hook->do_action()
#7 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/admin-ajax.php(192): do_action()
#8 {main}
  thrown in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/inc/Engine/WPRocketUninstall.php on line 158

can you please check 🙏

@Khadreal Khadreal requested a review from a team February 11, 2025 10:13
@Khadreal Khadreal requested review from Miraeld and a team February 12, 2025 15:51
@Khadreal Khadreal force-pushed the feature/7242-preload-fonts-data-insertion branch from 719adef to c7b1697 Compare February 12, 2025 16:03
@Mai-Saad
Copy link
Contributor

@Khadreal Can you please check this error when 🙏
1- fresh install (no activation)
2- delete the plugin

[19-Feb-2025 09:42:13 UTC] PHP Fatal error:  Uncaught Error: Class "WP_Rocket\Engine\Media\PreloadFonts\Database\Table\PreloadFonts" not found in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/uninstall.php:38
Stack trace:
#0 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/includes/plugin.php(1314): include_once()
#1 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/includes/plugin.php(970): uninstall_plugin()
#2 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/includes/ajax-actions.php(4771): delete_plugins()
#3 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(324): wp_ajax_delete_plugin()
#4 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#5 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/plugin.php(517): WP_Hook->do_action()
#6 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/admin-ajax.php(192): do_action()
#7 {main}
  thrown in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/uninstall.php on line 38

@Khadreal
Copy link
Contributor Author

@Khadreal Can you please check this error when 🙏 1- fresh install (no activation) 2- delete the plugin

[19-Feb-2025 09:42:13 UTC] PHP Fatal error:  Uncaught Error: Class "WP_Rocket\Engine\Media\PreloadFonts\Database\Table\PreloadFonts" not found in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/uninstall.php:38
Stack trace:
#0 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/includes/plugin.php(1314): include_once()
#1 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/includes/plugin.php(970): uninstall_plugin()
#2 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/includes/ajax-actions.php(4771): delete_plugins()
#3 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(324): wp_ajax_delete_plugin()
#4 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#5 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/plugin.php(517): WP_Hook->do_action()
#6 /var/www/new.rocketlabsqa.ovh/htdocs/wp-admin/admin-ajax.php(192): do_action()
#7 {main}
  thrown in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/wp-rocket/uninstall.php on line 38

Fixed @Mai-Saad

Copy link

codacy-production bot commented Feb 19, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for f8142151 69.77% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (f814215) Report Missing Report Missing Report Missing
Head commit (26ac802) 39257 17258 43.96%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7274) 172 120 69.77%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@Mai-Saad
Copy link
Contributor

Working fine

  • table structure matches lrc (but both different than lcp in terms of having created at + error msg is []) => if we are good there and nothing is needed for codacy then we can merge
  • This part of AC can't be tested on this PR and shall be checked later

Any possible error will be saved into the DB and status set to failed
If no fonts are found, we’ll save this fact to the database and set the status to completed
Remove failed jobs (the behaviour should be the same as with other priority elements features)

@Khadreal
Copy link
Contributor Author

  • of AC can't be tested on this PR and
  • error msgs is [] for lrc and preload fonts cause the way we handle it when not found is by sending empty array unlike lcp where we send 'not found'
  • Codacy can't be improved further I think 🤔

To unblock other issues, I'll move forward with this by merging the PR

@Khadreal Khadreal merged commit eeaa286 into feature/preload-fonts Feb 19, 2025
11 of 12 checks passed
@Khadreal Khadreal deleted the feature/7242-preload-fonts-data-insertion branch February 19, 2025 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3.19 - Preload Fonts - Data insertion part
5 participants