public function OAuthStoreSQL::setServerTokenTtl in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.2 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::setServerTokenTtl()
- 7.3 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::setServerTokenTtl()
- 7.4 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::setServerTokenTtl()
- 7.5 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::setServerTokenTtl()
- 7.6 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::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: * @param string token * @param int token_ttl
File
- lib/
oauth-php/ library/ store/ OAuthStoreSQL.php, line 657
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, oauth_consumer_registry
SET ost_token_ttl = DATE_ADD(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);
}
}