Make WordPress Core


Ignore:
Timestamp:
10/21/2017 01:21:24 PM (9 years ago)
Author:
dd32
Message:

Transients: Clear expired transients from the database in a daily cron task.

Fixes #41699

File:
1 edited

Legend:

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

    r41717 r41963  
    17471747        global $wp_current_db_version, $wpdb;
    17481748
    1749         // Always.
    1750         if ( is_main_network() ) {
    1751                 /*
    1752                  * Deletes all expired transients. The multi-table delete syntax is used
    1753                  * to delete the transient record from table a, and the corresponding
    1754                  * transient_timeout record from table b.
    1755                  */
    1756                 $time = time();
    1757                 $sql = "DELETE a, b FROM $wpdb->sitemeta a, $wpdb->sitemeta b
    1758                         WHERE a.meta_key LIKE %s
    1759                         AND a.meta_key NOT LIKE %s
    1760                         AND b.meta_key = CONCAT( '_site_transient_timeout_', SUBSTRING( a.meta_key, 17 ) )
    1761                         AND b.meta_value < %d";
    1762                 $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like ( '_site_transient_timeout_' ) . '%', $time ) );
    1763         }
     1749        // Always clear expired transients
     1750        delete_expired_transients( true );
    17641751
    17651752        // 2.8.
Note: See TracChangeset for help on using the changeset viewer.