Skip to content

Repair Tool: Compare filterable/cachable queries with direct DB queries before editing config - #7589

Open
pdclark wants to merge 1 commit into
pods-framework:mainfrom
pdclark:feature/repair-tool-verify-filters
Open

Repair Tool: Compare filterable/cachable queries with direct DB queries before editing config#7589
pdclark wants to merge 1 commit into
pods-framework:mainfrom
pdclark:feature/repair-tool-verify-filters

Conversation

@pdclark

@pdclark pdclark commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Description

Repair Tool, when checking Pods data structure, at times ran queries which could be altered by filters, including object and transient cache.

This draft compares each query to a direct database query, and if consistent, pauses the repair and surfaces a (currently long-winded) message indicating plugins may be effecting data structure.

If the query for maybe_fix_fields_with_invalid_field_type() were corrupted in particular, all fields would be converted to text type.

Related GitHub issue(s)

Slack Report: https://podswp.slack.com/archives/C02SVLHQF/p1785336123838039?thread_ts=1785276302.714959&cid=C02SVLHQF

Testing instructions

Create some Pods. Add one of these filters then attempt a repair:

add_filter(
    'pods_whatsit_storage_post_type_find_args',
    function( $post_args ) {
        unset( $post_args['meta_query'] );
        return $post_args;
    },
    10,
    1
);

add_filter(
    'posts_pre_query',
    function( $posts, $query ) {
        if ( in_array( $query->get('post_type'), ['_pods_group', '_pods_field' ] ) ) {
            return [];
        }
        return $posts;
    },
    10,
    2
);

Run wp pods tools flush-cache after adding the filters... Post_Type::find() caches results (correct or incorrect) to a one-week transient.

Changelog text for these changes

Repair Tool: Protect and notify of potential plugin conflicts.

PR checklist

There is a unit test... there was also an environment setup with scripts / WP CLI etc, not included...

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