Delete expired transients

isekai
Simon Costea 5 years ago
parent 9cd4bad7cc
commit 0940c8c863

@ -248,8 +248,7 @@ class OpenID_Connect_Generic_Client {
function new_state() {
// new state w/ timestamp
$state = md5( mt_rand() . microtime( true ) );
$expire = time() + $this->state_time_limit;
set_transient( 'openid-connect-generic-state--' . $state, $state, $expire );
set_transient( 'openid-connect-generic-state--' . $state, $state, $this->state_time_limit );
return $state;
}

@ -183,11 +183,12 @@ class OpenID_Connect_Generic {
*/
function cron_states_garbage_collection() {
global $wpdb;
$states = $wpdb->get_col( "SELECT `option_name` FROM {$wpdb->options} WHERE `option_name` LIKE 'openid-connect-generic-state--%'" );
$states = $wpdb->get_col( "SELECT `option_name` FROM {$wpdb->options} WHERE `option_name` LIKE '_transient_openid-connect-generic-state--%'" );
if ( !empty( $states ) ) {
foreach ( $states as $state ) {
get_transient( $state );
$transient = str_replace("_transient_", "", $state);
get_transient( $transient );
}
}
}

Loading…
Cancel
Save