Make WordPress Core

Ticket #64553: option-docblock-cleanup.patch

File option-docblock-cleanup.patch, 3.0 KB (added by solankisoftware, 6 weeks ago)

New updated patch

  • wp-includes/option.php

    (this hunk was shorter than expected) 
    16341634 *
    16351635 * @global wpdb $wpdb WordPress database abstraction object.
    16361636 *
    1637  * @param bool $force_db Optional. Force cleanup to run against the database even when an external object cache is used.
     1637 * @param bool        $force_db Optional. Force cleanup to run against the database even when an external object cache is used.
     1638 *                              Default false.
     1639 * @param string|bool $name     Optional. Transient name or prefix. If provided, only expired transients
     1640 *                              matching this name or prefix will be deleted. Default false.
    16381641 */
    1639 function delete_expired_transients( $force_db = false ) {
     1642function delete_expired_transients( $force_db = false, $name = false ) {
    16401643        global $wpdb;
    16411644
    16421645        if ( ! $force_db && wp_using_ext_object_cache() ) {
     
    16431648                return;
    16441649        }
    16451650
     1651        $transient_like = $wpdb->esc_like( '_transient_' . ( $name ? $name : '' ) ) . '%';
     1652        $timeout_like   = $wpdb->esc_like( '_transient_timeout_' ) . '%';
     1653
    16461654        $wpdb->query(
    16471655                $wpdb->prepare(
    16481656                        "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b
     
    16501658                        AND a.option_name NOT LIKE %s
    16511659                        AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )
    16521660                        AND b.option_value < %d",
    1653                         $wpdb->esc_like( '_transient_' ) . '%',
    1654                         $wpdb->esc_like( '_transient_timeout_' ) . '%',
     1661                        $transient_like,
     1662                        $timeout_like,
    16551663                        time()
    16561664                )
    16571665        );
    (this hunk was shorter than expected) 
    16591667        if ( ! is_multisite() ) {
     1668                $site_transient_like = $wpdb->esc_like( '_site_transient_' . ( $name ? $name : '' ) ) . '%';
     1669                $site_timeout_like   = $wpdb->esc_like( '_site_transient_timeout_' ) . '%';
     1670
    16601671                // Single site stores site transients in the options table.
    16611672                $wpdb->query(
    16621673                        $wpdb->prepare(
     
    16671678                                AND a.option_name NOT LIKE %s
    16681679                                AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) )
    16691680                                AND b.option_value < %d",
    1670                                 $wpdb->esc_like( '_site_transient_' ) . '%',
    1671                                 $wpdb->esc_like( '_site_transient_timeout_' ) . '%',
     1681                                $site_transient_like,
     1682                                $site_timeout_like,
    16721683                                time()
    16731684                        )
    16741685                );
    (this hunk was shorter than expected) 
    16761687        } elseif ( is_main_site() && is_main_network() ) {
     1688                $site_transient_like = $wpdb->esc_like( '_site_transient_' . ( $name ? $name : '' ) ) . '%';
     1689                $site_timeout_like   = $wpdb->esc_like( '_site_transient_timeout_' ) . '%';
     1690
    16771691                // Multisite stores site transients in the sitemeta table.
    16781692                $wpdb->query(
    16791693                        $wpdb->prepare(
     
    16841698                                AND a.meta_key NOT LIKE %s
    16851699                                AND b.meta_key = CONCAT( '_site_transient_timeout_', SUBSTRING( a.meta_key, 17 ) )
    16861700                                AND b.meta_value < %d",
    1687                                 $wpdb->esc_like( '_site_transient_' ) . '%',
    1688                                 $wpdb->esc_like( '_site_transient_timeout_' ) . '%',
     1701                                $site_transient_like,
     1702                                $site_timeout_like,
    16891703                                time()
    16901704                        )
    16911705                );