chore: commit vendor for offline build
Deploy Backend / deploy (push) Failing after 1m13s

This commit is contained in:
parsa aghaei committed 2026-06-28 16:47:17 +03:30
1 parent f7c532a648
commit 640bd67556
5801 files changed
+484532 -55857

No files matched your search

@@ -51,7 +51,7 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
private array $ageDirectives = [
'max-age' => null,
's-maxage' => null,
'expires' => null,
'expires' => false,
];
public function add(Response $response): void
@@ -79,15 +79,30 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
return;
}
$isHeuristicallyCacheable = $response->headers->hasCacheControlDirective('public');
$maxAge = $response->headers->hasCacheControlDirective('max-age') ? (int) $response->headers->getCacheControlDirective('max-age') : null;
$this->storeRelativeAgeDirective('max-age', $maxAge, $age, $isHeuristicallyCacheable);
$sharedMaxAge = $response->headers->hasCacheControlDirective('s-maxage') ? (int) $response->headers->getCacheControlDirective('s-maxage') : $maxAge;
$this->storeRelativeAgeDirective('s-maxage', $sharedMaxAge, $age, $isHeuristicallyCacheable);
$expires = $response->getExpires();
$expires = null !== $expires ? (int) $expires->format('U') - (int) $response->getDate()->format('U') : null;
$this->storeRelativeAgeDirective('expires', $expires >= 0 ? $expires : null, 0, $isHeuristicallyCacheable);
// See https://datatracker.ietf.org/doc/html/rfc7234#section-4.2.2
// If a response is "public" but does not have maximum lifetime, heuristics might be applied.
// Do not store NULL values so the final response can have more limiting value from other responses.
$isHeuristicallyCacheable = $response->headers->hasCacheControlDirective('public')
&& null === $maxAge
&& null === $sharedMaxAge
&& null === $expires;
if (!$isHeuristicallyCacheable || null !== $maxAge || null !== $expires) {
$this->storeRelativeAgeDirective('max-age', $maxAge, $expires, $age);
}
if (!$isHeuristicallyCacheable || null !== $sharedMaxAge || null !== $expires) {
$this->storeRelativeAgeDirective('s-maxage', $sharedMaxAge, $expires, $age);
}
if (null !== $expires) {
$this->ageDirectives['expires'] = true;
}
if (false !== $this->lastModified) {
$lastModified = $response->getLastModified();
@@ -146,9 +161,9 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
}
}
if (is_numeric($this->ageDirectives['expires'])) {
if ($this->ageDirectives['expires'] && null !== $maxAge) {
$date = clone $response->getDate();
$date = $date->modify('+'.($this->ageDirectives['expires'] + $this->age).' seconds');
$date = $date->modify('+'.$maxAge.' seconds');
$response->setExpires($date);
}
}
@@ -170,7 +185,7 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
// Etag headers cannot be merged, they render the response uncacheable
// by default (except if the response also has max-age etc.).
if (null === $response->getEtag() && \in_array($response->getStatusCode(), [200, 203, 300, 301, 410])) {
if (null === $response->getEtag() && \in_array($response->getStatusCode(), [200, 203, 300, 301, 410], true)) {
return false;
}
@@ -198,33 +213,16 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
* we have to subtract the age so that the value is normalized for an age of 0.
*
* If the value is lower than the currently stored value, we update the value, to keep a rolling
* minimal value of each instruction.
*
* If the value is NULL and the isHeuristicallyCacheable parameter is false, the directive will
* not be set on the final response. In this case, not all responses had the directive set and no
* value can be found that satisfies the requirements of all responses. The directive will be dropped
* from the final response.
*
* If the isHeuristicallyCacheable parameter is true, however, the current response has been marked
* as cacheable in a public (shared) cache, but did not provide an explicit lifetime that would serve
* as an upper bound. In this case, we can proceed and possibly keep the directive on the final response.
* minimal value of each instruction. If the value is NULL, the directive will not be set on the final response.
*/
private function storeRelativeAgeDirective(string $directive, ?int $value, int $age, bool $isHeuristicallyCacheable): void
private function storeRelativeAgeDirective(string $directive, ?int $value, ?int $expires, int $age): void
{
if (null === $value) {
if ($isHeuristicallyCacheable) {
/*
* See https://datatracker.ietf.org/doc/html/rfc7234#section-4.2.2
* This particular response does not require maximum lifetime; heuristics might be applied.
* Other responses, however, might have more stringent requirements on maximum lifetime.
* So, return early here so that the final response can have the more limiting value set.
*/
return;
}
if (null === $value && null === $expires) {
$this->ageDirectives[$directive] = false;
}
if (false !== $this->ageDirectives[$directive]) {
$value = min($value ?? \PHP_INT_MAX, $expires ?? \PHP_INT_MAX);
$value -= $age;
$this->ageDirectives[$directive] = null !== $this->ageDirectives[$directive] ? min($this->ageDirectives[$directive], $value) : $value;
}