You are here

public function OAuthStoreSQL::countServerTokens in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.2 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::countServerTokens()
  2. 7.3 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::countServerTokens()
  3. 7.4 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::countServerTokens()
  4. 7.5 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::countServerTokens()
  5. 7.6 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::countServerTokens()

* Count how many tokens we have for the given server * *

Parameters

string consumer_key: * @return int

Overrides OAuthStoreAbstract::countServerTokens

File

lib/oauth-php/library/store/OAuthStoreSQL.php, line 554

Class

OAuthStoreSQL

Code

public function countServerTokens($consumer_key) {
  $count = $this
    ->query_one('
					SELECT COUNT(oct_id)
					FROM oauth_consumer_token
							JOIN oauth_consumer_registry
							ON oct_ocr_id_ref = ocr_id
					WHERE oct_token_type   = \'access\'
					  AND ocr_consumer_key = \'%s\'
					  AND oct_token_ttl    >= NOW()
					', $consumer_key);
  return $count;
}