Skip to:
Content

bbPress.org

Changeset 6715


Ignore:
Timestamp:
09/26/2017 07:11:40 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Tools: Remove quotes from prepared query statements.

Also use the same esc_like() result in 2 matched queries.

Props jrf. Fixes #3168.

Location:
trunk/src/includes/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/classes/class-bbp-converter-base.php

    r6681 r6715  
    841841        /** Delete topics/forums/posts ****************************************/
    842842
    843         $query = ! empty( $this->sync_table )
    844             ? $this->wpdb->prepare( "SELECT value_id FROM {$this->sync_table_name} INNER JOIN {$this->wpdb->posts} ON(value_id = ID) WHERE meta_key LIKE '_bbp_%' AND value_type = %s GROUP BY value_id ORDER BY value_id DESC LIMIT {$this->max_rows}", 'post' )
    845             : $this->wpdb->prepare( "SELECT post_id AS value_id FROM {$this->wpdb->postmeta} WHERE meta_key LIKE %s GROUP BY post_id ORDER BY post_id DESC LIMIT {$this->max_rows}", $this->wpdb->esc_like( '_bbp_' ) . '%' );
     843        $esc_like = $this->wpdb->esc_like( '_bbp_' ) . '%';
     844        $query    = ! empty( $this->sync_table )
     845            ? $this->wpdb->prepare( "SELECT value_id FROM {$this->sync_table_name} INNER JOIN {$this->wpdb->posts} ON(value_id = ID) WHERE meta_key LIKE %s AND value_type = %s GROUP BY value_id ORDER BY value_id DESC LIMIT {$this->max_rows}", $esc_like, 'post' )
     846            : $this->wpdb->prepare( "SELECT post_id AS value_id FROM {$this->wpdb->postmeta} WHERE meta_key LIKE %s GROUP BY post_id ORDER BY post_id DESC LIMIT {$this->max_rows}", $esc_like );
    846847
    847848        $posts = $this->get_results( $query, ARRAY_A );
  • trunk/src/includes/admin/tools/repair.php

    r6668 r6715  
    10141014    $bbp_db        = bbp_db();
    10151015    $statement     = esc_html__( 'Repairing closed topics… %s', 'bbpress' );
    1016     $result        = esc_html__( 'No closed topics to repair.', 'bbpress' );
     1016    $result        = esc_html__( 'No closed topics to repair.',        'bbpress' );
    10171017    $changed       = 0;
    10181018
    10191019    // Results
    1020     $query         = "SELECT ID FROM `{$bbp_db->posts}` WHERE `post_type` = '%s' AND `post_status` = 'closed'";
    1021     $prepare       = $bbp_db->prepare( $query, bbp_get_topic_post_type() );
     1020    $query         = "SELECT ID FROM `{$bbp_db->posts}` WHERE `post_type` = %s AND `post_status` = %s";
     1021    $prepare       = $bbp_db->prepare( $query, bbp_get_topic_post_type(), bbp_get_closed_status_id() );
    10221022    $closed_topics = $bbp_db->get_col( $prepare );
    10231023
Note: See TracChangeset for help on using the changeset viewer.