Linux 软件免费装
Banner图

Switchrail Audit

开发者 nirajgirixd
mi5t4n
更新时间 2026年11月30日 11:45
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv3 or later
版权网址: 版权信息

标签

compatibility coding standards code analysis phpcs code review

下载

1.0.0

详情介绍:

This plugin checks a site's plugins, themes, database and file layout against the publicly documented WordPress VIP platform guidelines and the WordPress-VIP-Go coding standard. It reports what breaks those guidelines, and what to change it to. Use it as an everyday coding-standard and compatibility check, since the guidelines are a strict, well-documented bar for performance, security and scale on any host. Or use it as a checklist before moving a site to the platform. It scans every plugin, theme and must-use plugin with a PHP tokeniser rather than pattern-matching raw text, so a function name in a comment, a docblock or a string literal is not mistaken for a call, and $pdo->exec() is not mistaken for a shell command. Where a value cannot be resolved at analysis time, the finding says so and records its confidence instead of asserting an incompatibility it cannot prove. Findings are separated by what they actually are Each is scored independently for severity, detection confidence, and the kind of work the fix needs (automatic, manual, configuration, or architectural). That is the scanner's reasoning: it drives the ranking and is in every export. What the interface leads with is a single instruction derived from it — must fix, should fix, worth checking or FYI — used on every screen, so there is no vocabulary to learn before the report can be read. What every finding tells you The issue title, what was detected, why it matters on the WordPress VIP Platform specifically, the file, line and function, the line of code as evidence, the recommended fix, an alternative approach where one exists, a link to the WordPress VIP documentation the rule came from, and the rule id for a switchrail-audit:ignore annotation. Exports also carry the severity, confidence and matching WordPress-VIP-Go PHPCS sniff. What gets checked Reporting An overall score and the first three things to do; a map of every plugin, theme, table and path on the site, one square each, by verdict; one ranked list of fixes with the recommended change on the face of every entry, filtered from a column of one-click links; per-plugin, per-theme and per-table breakdowns; scan history with a change summary between runs; and export to JSON, CSV or Markdown for CI, an analysis sheet or a pull request. The admin menu carries a count of what must be fixed, so the work is visible from anywhere in wp-admin without opening the plugin. Accuracy Results are only as good as their false-positive rate, so the scanner resolves local variable assignments before judging a path, checks the fopen() mode so a file opened only for reading is not reported as a write, checks whether a query is cached before calling it uncached, and recognises that an admin-only response is not part of the edge cache. Where it still cannot be sure, it lowers the confidence and says why. Findings can be acknowledged in the source with a // switchrail-audit:ignore <rule-id> -- reason annotation. The plugin holds itself to the same standard: its own source passes phpcs --standard=WordPress-VIP-Go. Disclaimer Not affiliated with or endorsed by Automattic, WordPress VIP, or the WordPress Foundation.

安装:

  1. Download the plugin ZIP file.
  2. Go to your WordPress admin dashboard.
  3. Navigate to Plugins > Add New and click on Upload Plugin.
  4. Choose the downloaded ZIP file and click Install Now.
  5. After installation, click Activate to enable the plugin.

屏幕截图:

  • Findings, filtered to one tier, with a finding expanded to its evidence, rationale and remediation.
  • Plugins, with a row expanded to its author, location and findings.
  • Themes, with the active theme expanded.
  • Must-use plugins, each with where it belongs on WordPress VIP.
  • The database audit with per-table verdicts and the SQL to fix them.
  • The wp-content layout measured against the WordPress VIP application structure.

常见问题:

Do I need to host on WordPress VIP to use this?

No. The guidelines it checks against are public, and most describe good practice on any host. A few findings, such as "Redundant on WordPress VIP" or the wp-content layout, only matter if you host there or plan to.

Does a "Needs work" verdict mean the plugin cannot be used?

No. It means at least one finding is likely to cause problems on the WordPress VIP platform as written. Most are fixable — open Findings for the specific change required.

Why is uploads/ not reported as incompatible?

Because it is not. /wp-content/uploads/ is the one path under wp-content that application code may write to on WordPress VIP. It is imported with the WordPress VIP CLI rather than committed to the repository, which is why it is listed as "Not deployed" rather than as a problem.

Can I suppress a finding I have reviewed?

Yes. Add // switchrail-audit:ignore <rule-id> -- your reason to the line, or // switchrail-audit:ignore-next-line <rule-id> -- your reason above it. A reason is required. Security findings cannot be suppressed, so a plugin cannot hide its own shell calls or unescaped output.

Can I add or change rules?

Yes. Filter switchrail_audit_scanner_rules to add, modify or remove rules, and switchrail_audit_scanner_excluded_directories to change which directories are skipped.

Does this replace WordPress VIP code review?

No. It reads code without running it, so it cannot see behaviour that only appears under real traffic or real data. Test on a WordPress VIP environment before relying on the result.

更新日志:

1.0.0