Skip to content

Plugin Check: audit custom-table direct database findings #2298

@chubes4

Description

@chubes4

Summary

Most remaining packaged Plugin Check warnings are direct database/custom-table findings. These need review so WordPress.org-facing code is either clearly prepared/cached or intentionally justified.

Evidence

Packaged Plugin Check artifact:
/Users/chubes/Developer/wp-codebox@issue-167-plugin-check/artifacts/data-machine-package-plugin-check/runtime-mpoc8s65-1j1z9w/files/plugin-check/data-machine.json

Counts:

  • PluginCheck.Security.DirectDB.UnescapedDBParameter: 105
  • WordPress.DB.DirectDatabaseQuery.DirectQuery: 22
  • WordPress.DB.DirectDatabaseQuery.NoCaching: 22
  • WordPress.DB.DirectDatabaseQuery.SchemaChange: 13

Top affected files:

  • inc/Core/Database/Jobs/Jobs.php: 64 findings
  • inc/Core/Database/ProcessedItems/ProcessedItems.php: 19 findings
  • inc/Cli/Commands/ProcessedItemsCommand.php: 14 findings
  • inc/Core/Database/Pipelines/Pipelines.php: 12 findings
  • inc/Abilities/Job/RecoverStuckJobsAbility.php: 10 findings

Proposed fix

  • Audit each custom-table query for correct $wpdb->prepare() usage and safe dynamic table/column handling.
  • Add caching where appropriate or add narrowly scoped inline ignores with a clear explanation when a direct query is intentional and cache-inappropriate.
  • Separate schema-change operations from runtime query paths where possible.

Acceptance criteria

  • Packaged Plugin Check run has materially reduced custom-table/direct DB findings.
  • Any remaining direct DB ignores are narrow, documented, and tied to intentional custom-table behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions