You are here

public function OAuthStoreOracle::setConsumerAccessTokenTtl in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::setConsumerAccessTokenTtl()
  2. 7.2 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::setConsumerAccessTokenTtl()
  3. 7.3 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::setConsumerAccessTokenTtl()
  4. 7.5 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::setConsumerAccessTokenTtl()
  5. 7.6 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::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: * @param int ttl

Overrides OAuthStoreAbstract::setConsumerAccessTokenTtl

File

lib/oauth-php/library/store/OAuthStoreOracle.php, line 1269

Class

OAuthStoreOracle

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
    $sql = "BEGIN SP_SET_CONSUMER_ACC_TOKEN_TTL(:P_TOKEN, :P_TOKEN_TTL, :P_RESULT); END;";

    // parse sql
    $stmt = oci_parse($this->conn, $sql) or die('Can not parse query');

    // Bind In and Out Variables
    oci_bind_by_name($stmt, ':P_TOKEN', $token, 255);
    oci_bind_by_name($stmt, ':P_TOKEN_TTL', $token_ttl, 20);
    oci_bind_by_name($stmt, ':P_RESULT', $result, 20);

    //Execute the statement
    oci_execute($stmt);
  }
}