summaryrefslogtreecommitdiffstats
path: root/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php')
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php103
1 files changed, 94 insertions, 9 deletions
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php
index 84083058fe5..2f52405cf86 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php
@@ -25,6 +25,9 @@ class Google_Config
const GZIP_UPLOADS_ENABLED = true;
const GZIP_UPLOADS_DISABLED = false;
const USE_AUTO_IO_SELECTION = "auto";
+ const TASK_RETRY_NEVER = 0;
+ const TASK_RETRY_ONCE = 1;
+ const TASK_RETRY_ALWAYS = -1;
protected $configuration;
/**
@@ -44,6 +47,7 @@ class Google_Config
'auth_class' => 'Google_Auth_OAuth2',
'io_class' => self::USE_AUTO_IO_SELECTION,
'cache_class' => 'Google_Cache_File',
+ 'logger_class' => 'Google_Logger_Null',
// Don't change these unless you're working against a special development
// or testing environment.
@@ -54,6 +58,21 @@ class Google_Config
'Google_IO_Abstract' => array(
'request_timeout_seconds' => 100,
),
+ 'Google_IO_Curl' => array(
+ 'disable_proxy_workaround' => false,
+ 'options' => null,
+ ),
+ 'Google_Logger_Abstract' => array(
+ 'level' => 'debug',
+ 'log_format' => "[%datetime%] %level%: %message% %context%\n",
+ 'date_format' => 'd/M/Y:H:i:s O',
+ 'allow_newlines' => true
+ ),
+ 'Google_Logger_File' => array(
+ 'file' => 'php://stdout',
+ 'mode' => 0640,
+ 'lock' => false,
+ ),
'Google_Http_Request' => array(
// Disable the use of gzip on calls if set to true. Defaults to false.
'disable_gzip' => self::GZIP_ENABLED,
@@ -89,6 +108,36 @@ class Google_Config
'federated_signon_certs_url' =>
'https://www.googleapis.com/oauth2/v1/certs',
),
+ 'Google_Task_Runner' => array(
+ // Delays are specified in seconds
+ 'initial_delay' => 1,
+ 'max_delay' => 60,
+ // Base number for exponential backoff
+ 'factor' => 2,
+ // A random number between -jitter and jitter will be added to the
+ // factor on each iteration to allow for better distribution of
+ // retries.
+ 'jitter' => .5,
+ // Maximum number of retries allowed
+ 'retries' => 0
+ ),
+ 'Google_Service_Exception' => array(
+ 'retry_map' => array(
+ '500' => self::TASK_RETRY_ALWAYS,
+ '503' => self::TASK_RETRY_ALWAYS,
+ 'rateLimitExceeded' => self::TASK_RETRY_ALWAYS,
+ 'userRateLimitExceeded' => self::TASK_RETRY_ALWAYS
+ )
+ ),
+ 'Google_IO_Exception' => array(
+ 'retry_map' => !extension_loaded('curl') ? array() : array(
+ CURLE_COULDNT_RESOLVE_HOST => self::TASK_RETRY_ALWAYS,
+ CURLE_COULDNT_CONNECT => self::TASK_RETRY_ALWAYS,
+ CURLE_OPERATION_TIMEOUTED => self::TASK_RETRY_ALWAYS,
+ CURLE_SSL_CONNECT_ERROR => self::TASK_RETRY_ALWAYS,
+ CURLE_GOT_NOTHING => self::TASK_RETRY_ALWAYS
+ )
+ ),
// Set a default directory for the file cache.
'Google_Cache_File' => array(
'directory' => sys_get_temp_dir() . '/Google_Client'
@@ -98,7 +147,11 @@ class Google_Config
if ($ini_file_location) {
$ini = parse_ini_file($ini_file_location, true);
if (is_array($ini) && count($ini)) {
- $this->configuration = array_merge($this->configuration, $ini);
+ $merged_configuration = $ini + $this->configuration;
+ if (isset($ini['classes']) && isset($this->configuration['classes'])) {
+ $merged_configuration['classes'] = $ini['classes'] + $this->configuration['classes'];
+ }
+ $this->configuration = $merged_configuration;
}
}
}
@@ -107,9 +160,9 @@ class Google_Config
* Set configuration specific to a given class.
* $config->setClassConfig('Google_Cache_File',
* array('directory' => '/tmp/cache'));
- * @param $class The class name for the configuration
+ * @param $class string The class name for the configuration
* @param $config string key or an array of configuration values
- * @param $value optional - if $config is a key, the value
+ * @param $value string optional - if $config is a key, the value
*/
public function setClassConfig($class, $config, $value = null)
{
@@ -145,6 +198,15 @@ class Google_Config
}
/**
+ * Return the configured logger class.
+ * @return string
+ */
+ public function getLoggerClass()
+ {
+ return $this->configuration['logger_class'];
+ }
+
+ /**
* Return the configured Auth class.
* @return string
*/
@@ -156,7 +218,7 @@ class Google_Config
/**
* Set the auth class.
*
- * @param $class the class name to set
+ * @param $class string the class name to set
*/
public function setAuthClass($class)
{
@@ -172,7 +234,7 @@ class Google_Config
/**
* Set the IO class.
*
- * @param $class the class name to set
+ * @param $class string the class name to set
*/
public function setIoClass($class)
{
@@ -188,7 +250,7 @@ class Google_Config
/**
* Set the cache class.
*
- * @param $class the class name to set
+ * @param $class string the class name to set
*/
public function setCacheClass($class)
{
@@ -202,7 +264,24 @@ class Google_Config
}
/**
+ * Set the logger class.
+ *
+ * @param $class string the class name to set
+ */
+ public function setLoggerClass($class)
+ {
+ $prev = $this->configuration['logger_class'];
+ if (!isset($this->configuration['classes'][$class]) &&
+ isset($this->configuration['classes'][$prev])) {
+ $this->configuration['classes'][$class] =
+ $this->configuration['classes'][$prev];
+ }
+ $this->configuration['logger_class'] = $class;
+ }
+
+ /**
* Return the configured IO class.
+ *
* @return string
*/
public function getIoClass()
@@ -229,7 +308,7 @@ class Google_Config
/**
* Set the client ID for the auth class.
- * @param $key string - the API console client ID
+ * @param $clientId string - the API console client ID
*/
public function setClientId($clientId)
{
@@ -238,7 +317,7 @@ class Google_Config
/**
* Set the client secret for the auth class.
- * @param $key string - the API console client secret
+ * @param $secret string - the API console client secret
*/
public function setClientSecret($secret)
{
@@ -248,7 +327,8 @@ class Google_Config
/**
* Set the redirect uri for the auth class. Note that if using the
* Javascript based sign in flow, this should be the string 'postmessage'.
- * @param $key string - the URI that users should be redirected to
+ *
+ * @param $uri string - the URI that users should be redirected to
*/
public function setRedirectUri($uri)
{
@@ -305,6 +385,11 @@ class Google_Config
* Set the hd (hosted domain) parameter streamlines the login process for
* Google Apps hosted accounts. By including the domain of the user, you
* restrict sign-in to accounts at that domain.
+ *
+ * This should not be used to ensure security on your application - check
+ * the hd values within an id token (@see Google_Auth_LoginTicket) after sign
+ * in to ensure that the user is from the domain you were expecting.
+ *
* @param $hd string - the domain to use.
*/
public function setHostedDomain($hd)