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