Skip to content

Refactor gallery search query building#2347

Merged
the-hercules merged 5 commits into
developfrom
fix/gallery-search-query-handling
Jul 15, 2026
Merged

Refactor gallery search query building#2347
the-hercules merged 5 commits into
developfrom
fix/gallery-search-query-handling

Conversation

@iamimmanuelraj

Copy link
Copy Markdown
Member

Refactors the WHERE/JOIN construction in the gallery search filters (rtmedia_search_fillter_where_query / rtmedia_search_fillter_join_query) to build clauses with $wpdb->prepare() and $wpdb->esc_like() instead of manual string concatenation, and drops a redundant decode of the already-decoded search parameter. No change to search behavior.

Build the gallery search WHERE/JOIN clauses with $wpdb->prepare() and
$wpdb->esc_like() instead of manual string concatenation, and drop the
redundant decode of the already-decoded search parameter. No change to
search behavior.
Copilot AI review requested due to automatic review settings July 13, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Refactors gallery search SQL clause construction to reduce manual string concatenation by using $wpdb->prepare() / $wpdb->esc_like(), and removes an unnecessary urldecode() call while aiming to keep search behavior unchanged.

Changes:

  • Adds $wpdb->prepare() and $wpdb->esc_like() for multiple WHERE fragments in rtmedia_search_fillter_where_query().
  • Removes urldecode() from the search parameter sanitation pipeline.
  • Updates JOIN construction for attribute search to quote the slug via $wpdb->prepare().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php
Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
@the-hercules
the-hercules self-requested a review July 15, 2026 12:16
the-hercules
the-hercules previously approved these changes Jul 15, 2026
Copilot AI review requested due to automatic review settings July 15, 2026 12:34
the-hercules
the-hercules previously approved these changes Jul 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php

@krishana7911 krishana7911 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@the-hercules added some comments.

Copilot AI review requested due to automatic review settings July 15, 2026 13:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 13:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread app/main/controllers/template/rtmedia-filters.php Outdated
Comment thread app/main/controllers/template/rtmedia-filters.php
Comment thread app/main/controllers/template/rtmedia-filters.php
@krishana7911
krishana7911 self-requested a review July 15, 2026 13:47
krishana7911
krishana7911 previously approved these changes Jul 15, 2026
Copilot AI review requested due to automatic review settings July 15, 2026 13:54
@rtBot

rtBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Unable to PHPCS or SVG scan one or more files due to error running PHPCS/SVG scanner:

  • app/main/controllers/template/rtmedia-filters.php
  • app/main/controllers/template/rtmedia-functions.php

The error may be temporary. If the error persists, please contact a human (commit-ID: b7d7a9f).

@the-hercules
the-hercules merged commit 837a3dc into develop Jul 15, 2026
6 of 7 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment on lines +767 to +768
$author_id = implode( ',', array_map( 'absint', array_filter( explode( ',', $author_id ) ) ) );
$member_type = implode( ',', array_map( 'absint', array_filter( explode( ',', $member_type ) ) ) );
Comment on lines 813 to 817
$where .= " OR $table_name.media_author IN (" . $author_id . ') ';
}
if ( ! empty( $member_type ) ) {
$where .= " OR $table_name.media_author IN (" . $member_type . ') ';
}
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.

5 participants