Merge pull request #19894 from woocommerce/fix/woocommerce-delete-version-transients-limit
Don't schedule event to delete transients if limit set to 0
This commit is contained in:
commit
1d61f6fb01
|
@ -157,7 +157,12 @@ class WC_Cache_Helper {
|
|||
if ( ! wp_using_ext_object_cache() && ! empty( $version ) ) {
|
||||
global $wpdb;
|
||||
|
||||
$limit = apply_filters( 'woocommerce_delete_version_transients_limit', 1000 );
|
||||
$limit = apply_filters( 'woocommerce_delete_version_transients_limit', 1000 );
|
||||
|
||||
if ( ! $limit ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$affected = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s ORDER BY option_id LIMIT %d;", '\_transient\_%' . $version, $limit ) ); // WPCS: cache ok, db call ok.
|
||||
|
||||
// If affected rows is equal to limit, there are more rows to delete. Delete in 10 secs.
|
||||
|
|
Loading…
Reference in New Issue