Skip to content

Commit 464e657

Browse files
committed
BUGFIX: Fix content release manager ignoring currentContentRelease paramenter
1 parent 3b7b9f3 commit 464e657

1 file changed

Lines changed: 30 additions & 16 deletions

File tree

Classes/ContentReleaseManager.php

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,44 +56,58 @@ class ContentReleaseManager
5656
public function startIncrementalContentRelease(string $currentContentReleaseId = null, Workspace $workspace = null, array $additionalVariables = []): ContentReleaseIdentifier
5757
{
5858
$redis = $this->redisClientManager->getPrimaryRedis();
59-
if ($currentContentReleaseId) {
60-
$currentContentReleaseId = $redis->get(self::REDIS_CURRENT_RELEASE_KEY);
61-
}
6259

6360
$contentReleaseId = ContentReleaseIdentifier::create();
61+
62+
$currentContentReleaseIdOrFallback = $currentContentReleaseId
63+
?? $redis->get(self::REDIS_CURRENT_RELEASE_KEY)
64+
?: self::NO_PREVIOUS_RELEASE;
65+
66+
$workspaceName = $workspace !== null ? $workspace->getName() : 'live';
67+
68+
$accountId = $this->securityContext->isInitialized()
69+
? $this->securityContext->getAccount()->getAccountIdentifier()
70+
: null;
71+
6472
// the currentContentReleaseId is not used in any pipeline step in this package, but is a common need in other
6573
// use cases in extensions, e.g. calculating the differences between current and new release
6674
$this->prunnerApiService->schedulePipeline(PipelineName::create('do_content_release'), array_merge($additionalVariables, [
6775
'contentReleaseId' => $contentReleaseId,
68-
'currentContentReleaseId' => $currentContentReleaseId ?: self::NO_PREVIOUS_RELEASE,
76+
'currentContentReleaseId' => $currentContentReleaseIdOrFallback,
6977
'validate' => true,
70-
'workspaceName' => $workspace ? $workspace->getName() : 'live',
71-
'accountId' => $this->securityContext->isInitialized()
72-
? $this->securityContext->getAccount()->getAccountIdentifier() :
73-
null,
78+
'workspaceName' => $workspaceName,
79+
'accountId' => $accountId,
7480
]));
81+
7582
return $contentReleaseId;
7683
}
7784

7885
// the validate parameter can be used to intentionally skip the validation step for this release
7986
public function startFullContentRelease(bool $validate = true, string $currentContentReleaseId = null, Workspace $workspace = null, array $additionalVariables = []): ContentReleaseIdentifier
8087
{
8188
$redis = $this->redisClientManager->getPrimaryRedis();
82-
if ($currentContentReleaseId) {
83-
$currentContentReleaseId = $redis->get(self::REDIS_CURRENT_RELEASE_KEY);
84-
}
8589

8690
$contentReleaseId = ContentReleaseIdentifier::create();
91+
92+
$currentContentReleaseIdOrFallback = $currentContentReleaseId
93+
?? $redis->get(self::REDIS_CURRENT_RELEASE_KEY)
94+
?: self::NO_PREVIOUS_RELEASE;
95+
96+
$workspaceName = $workspace !== null ? $workspace->getName() : 'live';
97+
98+
$accountId = $this->securityContext->isInitialized()
99+
? $this->securityContext->getAccount()->getAccountIdentifier()
100+
: null;
101+
87102
$this->contentCache->flush();
88103
$this->prunnerApiService->schedulePipeline(PipelineName::create('do_content_release'), array_merge($additionalVariables, [
89104
'contentReleaseId' => $contentReleaseId,
90-
'currentContentReleaseId' => $currentContentReleaseId ?: self::NO_PREVIOUS_RELEASE,
105+
'currentContentReleaseId' => $currentContentReleaseIdOrFallback,
91106
'validate' => $validate,
92-
'workspaceName' => $workspace ? $workspace->getName() : 'live',
93-
'accountId' => $this->securityContext->isInitialized()
94-
? $this->securityContext->getAccount()->getAccountIdentifier() :
95-
null,
107+
'workspaceName' => $workspaceName,
108+
'accountId' => $accountId,
96109
]));
110+
97111
return $contentReleaseId;
98112
}
99113

0 commit comments

Comments
 (0)