Merge pull request #5292 from kloon/fix-session-autoloading

Fix _wc_session_expires autoloading
This commit is contained in:
Mike Jolley 2014-04-08 15:39:09 +01:00
commit 94fb5e4aab
1 changed files with 7 additions and 1 deletions

View File

@ -45,7 +45,13 @@ class WC_Session_Handler extends WC_Session {
// Update session if its close to expiring
if ( time() > $this->_session_expiring ) {
$this->set_session_expiration();
update_option( '_wc_session_expires_' . $this->_customer_id, $this->_session_expiration );
$session_expiry_option = '_wc_session_expires_' . $this->_customer_id;
// Check if option exists first to avoid auloading cleaned up sessions
if ( false === get_option( $session_expiry_option ) ) {
add_option( $session_expiry_option, $this->_session_expiration, '', 'no' );
} else {
update_option( $session_expiry_option, $this->_session_expiration );
}
}
} else {