update lock clucknut
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 14s
Build, Push and Deploy / build-and-push (push) Successful in 3m14s
Build, Push and Deploy / deploy-staging (push) Successful in 25s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-18 20:32:18 +07:00
parent 4554035227
commit dcaf267458
3359 changed files with 153185 additions and 205489 deletions

View File

@@ -83,6 +83,12 @@ class RequestWrapper
*/
private $retryFunction;
/**
* @var callable|null Lets the user listen for retries and
* modify the next retry arguments
*/
private $retryListener;
/**
* @var callable Executes a delay.
*/
@@ -136,6 +142,8 @@ class RequestWrapper
* determining how long to wait between attempts to retry. Function
* signature should match: `function (int $attempt) : int`.
* @type string $universeDomain The expected universe of the credentials. Defaults to "googleapis.com".
* @type callable $restRetryListener A function to run custom logic between retries. This function can modify
* the next server call arguments for the next retry.
* }
*/
public function __construct(array $config = [])
@@ -151,6 +159,7 @@ public function __construct(array $config = [])
'componentVersion' => null,
'restRetryFunction' => null,
'restDelayFunction' => null,
'restRetryListener' => null,
'restCalcDelayFunction' => null,
'universeDomain' => GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN,
];
@@ -160,6 +169,7 @@ public function __construct(array $config = [])
$this->restOptions = $config['restOptions'];
$this->shouldSignRequest = $config['shouldSignRequest'];
$this->retryFunction = $config['restRetryFunction'] ?: $this->getRetryFunction();
$this->retryListener = $config['restRetryListener'];
$this->delayFunction = $config['restDelayFunction'] ?: function ($delay) {
usleep($delay);
};
@@ -362,7 +372,7 @@ private function applyHeaders(RequestInterface $request, array $options = [])
*/
private function addAuthHeaders(RequestInterface $request, FetchAuthTokenInterface $fetcher)
{
$backoff = new ExponentialBackoff($this->retries, $this->getRetryFunction());
$backoff = new ExponentialBackoff($this->retries, $this->getRetryFunction(), $this->retryListener);
try {
return $backoff->execute(
@@ -485,7 +495,7 @@ private function getRetryOptions(array $options)
: $this->retryFunction,
'retryListener' => isset($options['restRetryListener'])
? $options['restRetryListener']
: null,
: $this->retryListener,
'delayFunction' => isset($options['restDelayFunction'])
? $options['restDelayFunction']
: $this->delayFunction,

View File

@@ -30,7 +30,7 @@
use Google\Cloud\Speech\SpeechClient as DeprecatedSpeechClient;
use Google\Cloud\Speech\V2\Client\SpeechClient;
use Google\Cloud\Storage\StorageClient;
use Google\Cloud\Trace\TraceClient;
use Google\Cloud\Trace\V2\Client\TraceServiceClient;
use Google\Cloud\Translate\V2\TranslateClient as DeprecatedTranslateClient;
use Google\Cloud\Translate\V3\Client\TranslationServiceClient;
use Google\Cloud\Vision\V1\Client\ImageAnnotatorClient;
@@ -311,22 +311,16 @@ public function storage(array $config = [])
}
/**
* Google Stackdriver Trace allows you to collect latency data from your applications
* and display it in the Google Cloud Platform Console. Find more information at
* [Stackdriver Trace API docs](https://cloud.google.com/trace/docs/).
*
* Example:
* ```
* $trace = $cloud->trace();
* ```
*
* @param array $config [optional] Configuration options. See
* {@see \Google\Cloud\Core\ServiceBuilder::__construct()} for the available options.
* @return TraceClient
* @deprecated
* @see TraceServiceClient
* @throws \BadMethodCallException
*/
public function trace(array $config = [])
{
return $this->createClient(TraceClient::class, 'trace', $config);
throw new \BadMethodCallException(sprintf(
'This method is no longer supported, create %s directly instead.',
TraceServiceClient::class
));
}
/**

View File

@@ -126,8 +126,9 @@ private function lex(string $contents): array
return Utils::pregSplit(
'/\{
# "{@}" is not a valid inline tag. This ensures that we do not treat it as one, but treat it literally.
(?!@\})
# "{@}" and "{@*}" are not a valid inline tags. This ensures that we do not treat them as one, but treat
# them literally.
(?!(?:@\}|@\*\}) )
# We want to capture the whole tag line, but without the inline tag delimiters.
(\@
# Match everything up to the next delimiter.

View File

@@ -35,8 +35,6 @@ trait StubTrait
public function ___getProperty($prop)
{
$property = $this->___getPropertyReflector($prop);
$property->setAccessible(true);
return $property->getValue($this);
}
@@ -54,8 +52,6 @@ public function ___setProperty($prop, $value)
}
$property = $this->___getPropertyReflector($prop);
$property->setAccessible(true);
$property->setValue($this, $value);
}

View File

@@ -98,6 +98,9 @@ private function prepareRequest()
$headers['Content-Length'] = $size;
}
$customHeaders = $this->requestOptions['restOptions']['headers'] ?? [];
$headers = array_merge($headers, $customHeaders);
return new Request(
'POST',
$this->uri,

View File

@@ -170,6 +170,16 @@ public function upload()
'Content-Range' => "bytes $rangeStart-$rangeEnd/$size",
];
$customHeaders = $this->requestOptions['restOptions']['headers'] ?? [];
// Check if this chunk is the final one
$isFinalChunk = ($size !== '*' && (int) ($rangeEnd + 1) === (int) $size);
if (!$isFinalChunk) {
unset($customHeaders['X-Goog-Hash']);
}
$headers = array_merge($headers, $customHeaders);
$request = new Request(
'PUT',
$resumeUri,

View File

@@ -43,10 +43,12 @@ public function upload($writeSize = null)
return [];
}
$isFinalRequest = ($writeSize === null);
// find or create the resumeUri
$resumeUri = $this->getResumeUri();
if ($writeSize) {
if ($writeSize !== null) {
$rangeEnd = $this->rangeStart + $writeSize - 1;
$data = $this->data->read($writeSize);
} else {
@@ -62,6 +64,14 @@ public function upload($writeSize = null)
'Content-Range' => "bytes {$this->rangeStart}-$rangeEnd/*"
];
$customHeaders = $this->requestOptions['restOptions']['headers'] ?? [];
// Only include X-Goog-Hash if this is the final request
if (!$isFinalRequest) {
unset($customHeaders['X-Goog-Hash']);
}
$headers = array_merge($headers, $customHeaders);
$request = new Request(
'PUT',
$resumeUri,