Make WordPress Core


Ignore:
Timestamp:
10/18/2013 07:47:44 AM (11 years ago)
Author:
nacin
Message:

Delete expired transients on database upgrades.

Reverts [25416], which had all transients being cleared. This leaves much to be desired, but we don't want a core update to be blamed for breaking a site that incorrectly assumes transients aren't transient.

props dartiss, pento.
fixes #20316.

File:
1 edited

Legend:

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

    r25825 r25838  
    12301230function upgrade_network() {
    12311231    global $wp_current_db_version, $wpdb;
     1232
     1233    // Always
     1234    if ( is_main_network() ) {
     1235        // Deletes all expired transients.
     1236        // The multi-table delete syntax is used to delete the transient record from table a,
     1237        // and the corresponding transient_timeout record from table b.
     1238        $time = time();
     1239        $wpdb->query("DELETE a, b FROM $wpdb->sitemeta a, $wpdb->sitemeta b WHERE
     1240            a.meta_key LIKE '\_site\_transient\_%' AND
     1241            a.meta_key NOT LIKE '\_site\_transient\_timeout\_%' AND
     1242            b.meta_key = CONCAT( '_site_transient_timeout_', SUBSTRING( a.meta_key, 17 ) )
     1243            AND b.meta_value < $time");
     1244    }
     1245
    12321246    // 2.8
    12331247    if ( $wp_current_db_version < 11549 ) {
Note: See TracChangeset for help on using the changeset viewer.