public function OAuthStorePostgreSQL::setConsumerAccessTokenTtl in Lingotek Translation 7.5
Same name and namespace in other branches
- 7.7 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::setConsumerAccessTokenTtl()
- 7.2 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::setConsumerAccessTokenTtl()
- 7.3 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::setConsumerAccessTokenTtl()
- 7.4 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::setConsumerAccessTokenTtl()
- 7.6 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::setConsumerAccessTokenTtl()
Set the ttl of a consumer access token. This is done when the server receives a valid request with a xoauth_token_ttl parameter in it.
Parameters
string token:
int ttl:
Overrides OAuthStoreAbstract::setConsumerAccessTokenTtl
File
- lib/
oauth-php/ library/ store/ OAuthStorePostgreSQL.php, line 1483
Class
Code
public function setConsumerAccessTokenTtl($token, $token_ttl) {
if ($token_ttl <= 0) {
// Immediate delete when the token is past its ttl
$this
->deleteConsumerAccessToken($token, 0, true);
}
else {
// Set maximum time to live for this token
$this
->query('
UPDATE oauth_server_token
SET ost_token_ttl = (NOW() + INTERVAL \'%d SECOND\')
WHERE ost_token = \'%s\'
AND ost_token_type = \'access\'
', $token_ttl, $token);
}
}