diff options
author | tailor <cygnus@janrain.com> | 2007-09-24 18:31:33 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2007-09-24 18:31:33 +0000 |
commit | f9d88780e22f049e92c7a23b39ce0b2784ef3021 (patch) | |
tree | 519214b07a286c4d3d7b9e962b6fd9c9eabe413d /Auth/OpenID/SQLStore.php | |
parent | 0f270daead5c4821861718c734e55e54ed7ca4d7 (diff) | |
download | php-openid-f9d88780e22f049e92c7a23b39ce0b2784ef3021.zip php-openid-f9d88780e22f049e92c7a23b39ce0b2784ef3021.tar.gz php-openid-f9d88780e22f049e92c7a23b39ce0b2784ef3021.tar.bz2 |
[project @ Add cleanupNonces to SQL stores]
Diffstat (limited to 'Auth/OpenID/SQLStore.php')
-rw-r--r-- | Auth/OpenID/SQLStore.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Auth/OpenID/SQLStore.php b/Auth/OpenID/SQLStore.php index 0f58203..4192022 100644 --- a/Auth/OpenID/SQLStore.php +++ b/Auth/OpenID/SQLStore.php @@ -35,6 +35,11 @@ require_once 'Auth/OpenID/Nonce.php'; require_once 'Auth/OpenID.php'; /** + * @access private + */ +require_once 'Auth/OpenID/Nonce.php'; + +/** * This is the parent class for the SQL stores, which contains the * logic common to all of the SQL stores. * @@ -250,7 +255,8 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { array( 'value' => $this->nonces_table_name, 'keys' => array('nonce_table', - 'add_nonce') + 'add_nonce', + 'clean_nonce') ), array( 'value' => $this->associations_table_name, @@ -553,6 +559,17 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { return $result; } + + function cleanupNonces() + { + global $Auth_OpenID_SKEW; + $v = time() - $Auth_OpenID_SKEW; + + $this->connection->query($this->sql['clean_nonce'], array($v)); + $num = $this->connection->affectedRows(); + $this->connection->commit(); + return $num; + } } ?> |