Skip to content

Fetch known-plugins.json from wp.org with daily SVN sync#78

Draft
ilicfilip wants to merge 11 commits intodevelopfrom
filip/remote-known-plugins
Draft

Fetch known-plugins.json from wp.org with daily SVN sync#78
ilicfilip wants to merge 11 commits intodevelopfrom
filip/remote-known-plugins

Conversation

@ilicfilip
Copy link
Copy Markdown
Collaborator

Summary

  • Plugin now fetches known-plugins.json from https://ps.w.org/aaa-option-optimizer/assets/known-plugins.json daily via WP-Cron, with the bundled JSON as fallback.
  • New GitHub Action validates the JSON and publishes it to wp.org SVN assets/ daily (and on push to develop/main when the file changes), so users get mapping updates without waiting for a plugin release.
  • Foundation for an upcoming "Report unknown option" feature — Phase 3 will add the in-plugin submission UI on top of this branch.

Notes for reviewer

  • Reuses existing SVN_USERNAME / SVN_PASSWORD repo secrets.
  • Scheduled workflows run on the repo's default branch — confirm that's the desired source of truth, otherwise we should pin ref: main.
  • Until the file is committed to wp.org SVN once (the first scheduled run will do this automatically, or can be triggered via workflow_dispatch), every install silently uses the bundled fallback.
  • Validator surfaces one warning on current data: siteground_data_ is claimed by both sg-optimizer and sg-security. Treated as a warning, not an error.

Test plan

  • PHPStan + PHPCS pass on touched files
  • php bin/validate-known-plugins.php exits 0 against current JSON
  • Manually trigger workflow (workflow_dispatch) and confirm assets/known-plugins.json lands on wp.org SVN
  • On a test site, confirm the cron event aaa_option_optimizer_refresh_known_plugins is registered
  • Confirm Map_Plugin_To_Options::get_plugin_name() still resolves a known prefix (e.g. aioseo_* → AIOSEO)
  • Simulate a 404 on the remote URL and confirm fallback to bundled JSON

🤖 Generated with Claude Code

ilicfilip and others added 2 commits May 7, 2026 17:02
Adds a Known_Plugins loader that caches a remote copy of the mapping
and falls back to the bundled JSON. A daily WP-Cron event refreshes
the cache from https://ps.w.org/aaa-option-optimizer/assets/known-plugins.json.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Daily GitHub Action validates known-plugins.json and publishes it to
the plugin's wp.org /assets/ directory so installs can fetch updates
without waiting for a release. Validator rejects malformed JSON,
missing fields, and dangerously generic prefixes.

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

github-actions Bot commented May 7, 2026

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

ilicfilip and others added 9 commits May 7, 2026 17:54
The validator runs in GitHub Actions, not in WordPress, so
WordPress-specific sniffs (escaping, $-prefix globals, WP_Filesystem)
don't apply.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The runtime guard in Plugin::register_hooks() already self-heals the
schedule for every install. Activation-time scheduling was redundant.
Uninstall now also removes the cached mapping option and clears the
cron event as defense-in-depth.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
For rows where no plugin matched, the Source column becomes a button
that opens a popover. User pastes a wp.org slug or URL; the plugin
verifies it via api.wordpress.org and shows the official plugin name.
On submit, the report is POSTed to the configurable submission endpoint
(filterable via aaa_option_optimizer_report_url) for the maintainer
to triage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop dashed-border button look. Render label and action as plain text
with the action subtly underlined. Force single-line so the row
doesn't grow when the trigger is shown.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Per-popover verify-debounce timer instead of a single shared one,
  so concurrently-open popovers don't cancel each other's lookup.
- Stable popover ids via a counter, eliminating collisions when two
  unknown option names normalize to the same slug.
- Drop dead svn-mkdir fallback and redundant mkdir in the SVN sync
  workflow; assets/ always exists on wp.org plugin SVN.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Worker now lives in its own private repo, ProgressPlanner/aaa-option-optimizer-api.
No longer needs a local exclusion in this repo's gitignore.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Cron, push, and workflow_dispatch all check out main now. Develop work
no longer propagates to wp.org SVN — main is the source of truth for
what installs fetch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds an "External services" section disclosing wp.org and the
report-submission endpoint, as required by wp.org plugin review.
Adds a 1.7.0 changelog entry covering the Report-origin feature
and the daily known-plugins refresh. Version bump itself lands in
the release PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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