Skip to content

Add LiteSpeed Cache integration with interactive tasks - #760

Open
ilicfilip wants to merge 4 commits into
developfrom
filip/litespeed-cache-integration
Open

Add LiteSpeed Cache integration with interactive tasks#760
ilicfilip wants to merge 4 commits into
developfrom
filip/litespeed-cache-integration

Conversation

@ilicfilip

Copy link
Copy Markdown
Collaborator

Summary

  • Adds LiteSpeed Cache plugin integration following the existing AIOSEO pattern
  • 6 interactive tasks that let users enable key performance settings directly from Progress Planner:
    • Page cache — foundation caching feature
    • Browser cache — client-side caching for repeat visitors
    • CSS minification — reduces CSS file sizes
    • JS minification — reduces JS file sizes
    • Image lazy loading — defers below-fold images
    • Guest mode — improves cache hit ratio for anonymous visitors
  • Each task uses custom AJAX handlers with proper security (nonce + capability + plugin-active checks)
  • Tasks only appear when LiteSpeed Cache is active and the corresponding setting is disabled

Test plan

  • Install and activate LiteSpeed Cache plugin
  • Verify all 6 tasks appear in Progress Planner suggested tasks
  • Click "Enable" on each task popover and verify the setting gets toggled on
  • Verify task completes with confetti after enabling
  • Deactivate LiteSpeed Cache and verify tasks disappear
  • Verify tasks don't appear when settings are already enabled

🤖 Generated with Claude Code

Add suggested tasks for LiteSpeed Cache plugin users to enable key
performance settings directly from Progress Planner. Follows the
existing AIOSEO integration pattern with custom AJAX handlers.

Tasks: page cache, browser cache, CSS/JS minification, image lazy
loading, and guest mode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Test on Playground
Test this pull request on the Playground
or download the zip

@github-actions

github-actions Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
10 0 10

⚠️ Warnings (10)

📁 classes/suggested-tasks/providers/class-content-review.php (4 warnings)
📍 Line 🔖 Check 💬 Message
232 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
377 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
381 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
388 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/suggested-tasks/data-collector/class-unpublished-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
103 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/suggested-tasks/data-collector/class-yoast-orphaned-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
111 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_row()\n$query assigned unsafely at line 98.
📁 classes/suggested-tasks/data-collector/class-terms-without-description.php (1 warning)
📍 Line 🔖 Check 💬 Message
108 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 106.
📁 classes/suggested-tasks/data-collector/class-terms-without-posts.php (1 warning)
📍 Line 🔖 Check 💬 Message
120 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 118.
📁 classes/activities/class-query.php (2 warnings)
📍 Line 🔖 Check 💬 Message
71 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $table_name used in $wpdb->query()\n$table_name assigned unsafely at line 58.
163 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $where_args used in $wpdb->get_results()\n$where_args assigned unsafely at line 153.

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@github-actions

github-actions Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

✅ Code Coverage Report

Metric Value
Total Coverage 31.93% 📉
Base Coverage 32.27%
Difference 📉 -0.34%

⚠️ Coverage below recommended 40% threshold

📊 File-level Coverage Changes (10 files)

🆕 New Files

Class Coverage Lines
🔴 Progress_Planner\Suggested_Tasks\Providers\Integrations\Litespeed_Cache\Add_Litespeed_Cache_Providers 0.00% 0/14
🔴 Progress_Planner\Suggested_Tasks\Providers\Integrations\Litespeed_Cache\Browser_Cache 0.00% 0/15
🔴 Progress_Planner\Suggested_Tasks\Providers\Integrations\Litespeed_Cache\Css_Minification 0.00% 0/15
🔴 Progress_Planner\Suggested_Tasks\Providers\Integrations\Litespeed_Cache\Guest_Mode 14.29% 2/14
🔴 Progress_Planner\Suggested_Tasks\Providers\Integrations\Litespeed_Cache\Image_Lazy_Load 0.00% 0/15
🔴 Progress_Planner\Suggested_Tasks\Providers\Integrations\Litespeed_Cache\Js_Minification 0.00% 0/15
🟢 Progress_Planner\Suggested_Tasks\Providers\Integrations\Litespeed_Cache\Litespeed_Cache_Interactive_Provider 87.50% 7/8
🔴 Progress_Planner\Suggested_Tasks\Providers\Integrations\Litespeed_Cache\Page_Cache 0.00% 0/14
🔴 Progress_Planner\Suggested_Tasks\Providers\Traits\Ajax_Security_Litespeed_Cache 0.00% 0/4

📉 Coverage Decreased

Class Before After Change
Progress_Planner\Suggested_Tasks\Tasks_Manager 62.83% 62.28% -0.55%
ℹ️ About this report
  • All tests run in a single job with Xdebug coverage
  • Security tests excluded from coverage to prevent output issues
  • Coverage calculated from line coverage percentages

update_litespeed_option() wrote the option row directly. Saving a setting
in LiteSpeed is more than a database write: Conf::update_confs() casts
the value to the option's declared type, purges the caches the change
invalidates, updates the relevant cron, and refreshes LiteSpeed's
in-memory config.

Guest mode is the clearest case. conf.cls.php resets the crawler's
disabled list when `guest` changes, and one of this PR's six tasks writes
exactly that key, so the reset was being skipped.

Verified against LiteSpeed Cache 7.9. Enabling guest mode through the
provider now prints "Crawler disabled list is cleared!" and the in-memory
config agrees with the stored value. With the old direct write, no reset
fired and Conf::conf('guest') still reported false while the option row
said 1 -- the running request saw a different value than the database.

Falls back to update_option() when LiteSpeed's class is absent, so this
keeps working if the plugin's internals move.

Adds tests with a stub standing in for \LiteSpeed\Conf, since the plugin
is not installed in CI: that updates are handed to Conf::update_confs(),
that a value LiteSpeed did not store is reported as failure rather than
assumed, that each provider passes its own option key, and that
should_add_task() follows the setting including a cast string value.
Verified by mutation -- restoring the direct write fails three of them.
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.

1 participant