Make WordPress Core


Ignore:
Timestamp:
06/10/2014 12:43:32 AM (11 years ago)
Author:
wonderboymusic
Message:

Replace all uses of like_escape() with $wpdb->esc_like().

Props miqrogroove.
See #10041.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/schema.php

    r28633 r28712  
    554554    // and the corresponding transient_timeout record from table b.
    555555    $time = time();
    556     $wpdb->query("DELETE a, b FROM $wpdb->options a, $wpdb->options b WHERE
    557             a.option_name LIKE '\_transient\_%' AND
    558             a.option_name NOT LIKE '\_transient\_timeout\_%' AND
    559             b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )
    560             AND b.option_value < $time");
     556    $sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b
     557        WHERE a.option_name LIKE %s
     558        AND a.option_name NOT LIKE %s
     559        AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )
     560        AND b.option_value < %d";
     561    $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_transient_' ) . '%', $wpdb->esc_like( '_transient_timeout_' ) . '%', $time ) );
    561562
    562563    if ( is_main_site() && is_main_network() ) {
    563         $wpdb->query("DELETE a, b FROM $wpdb->options a, $wpdb->options b WHERE
    564             a.option_name LIKE '\_site\_transient\_%' AND
    565             a.option_name NOT LIKE '\_site\_transient\_timeout\_%' AND
    566             b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) )
    567             AND b.option_value < $time");
    568     }
     564        $sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b
     565            WHERE a.option_name LIKE %s
     566            AND a.option_name NOT LIKE %s
     567            AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) )
     568            AND b.option_value < %d";
     569        $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like( '_site_transient_timeout_' ) . '%', $time ) );
     570    }
    569571}
    570572
Note: See TracChangeset for help on using the changeset viewer.