Chunk option names in cleanup_sessions() Closes #5225

This commit is contained in:
Mike Jolley 2014-04-01 14:51:41 +01:00
parent f4001d1373
commit 6deac5cf4b
1 changed files with 5 additions and 2 deletions

View File

@ -181,9 +181,12 @@ class WC_Session_Handler extends WC_Session {
}
if ( ! empty( $expired_sessions ) ) {
$option_names = implode( "','", $expired_sessions );
$expired_sessions_chunked = array_chunk( $expired_sessions, 100 );
foreach ( $expired_sessions_chunked as $chunk ) {
$option_names = implode( "','", $chunk );
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')" );
}
}
}
}
}