-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathContentReleasePrepareCommandController.php
More file actions
73 lines (61 loc) · 2.94 KB
/
ContentReleasePrepareCommandController.php
File metadata and controls
73 lines (61 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
declare(strict_types=1);
namespace Flowpack\DecoupledContentStore\Command;
use Flowpack\DecoupledContentStore\Core\ConcurrentBuildLockService;
use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\PrunnerJobId;
use Flowpack\DecoupledContentStore\PrepareContentRelease\Infrastructure\RedisContentReleaseService;
use Neos\Flow\Annotations as Flow;
use Flowpack\DecoupledContentStore\Core\Domain\ValueObject\ContentReleaseIdentifier;
use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger;
use Neos\Flow\Cli\CommandController;
use Neos\Fusion\Core\Cache\ContentCache;
/**
* Commands for the PREPARE stage in the pipeline. Not meant to be called manually.
*/
class ContentReleasePrepareCommandController extends CommandController
{
/**
* @Flow\Inject
* @var RedisContentReleaseService
*/
protected $redisContentReleaseService;
/**
* @Flow\Inject
* @var ConcurrentBuildLockService
*/
protected $concurrentBuildLock;
/**
* @Flow\Inject
* @var ContentCache
*/
protected $contentCache;
public function createContentReleaseCommand(string $contentReleaseIdentifier, string $prunnerJobId, string $workspaceName = 'live'): void
{
$contentReleaseIdentifier = ContentReleaseIdentifier::fromString($contentReleaseIdentifier);
$prunnerJobId = PrunnerJobId::fromString($prunnerJobId);
$logger = ContentReleaseLogger::fromConsoleOutput($this->output, $contentReleaseIdentifier);
$this->redisContentReleaseService->createContentRelease($contentReleaseIdentifier, $prunnerJobId, $logger, $workspaceName);
}
public function ensureAllOtherInProgressContentReleasesWillBeTerminatedCommand(string $contentReleaseIdentifier): void
{
$contentReleaseIdentifier = ContentReleaseIdentifier::fromString($contentReleaseIdentifier);
$this->concurrentBuildLock->ensureAllOtherInProgressContentReleasesWillBeTerminated($contentReleaseIdentifier);
}
public function registerManualTransferJobCommand(string $contentReleaseIdentifier, string $prunnerJobId): void
{
$contentReleaseIdentifier = ContentReleaseIdentifier::fromString($contentReleaseIdentifier);
$prunnerJobId = PrunnerJobId::fromString($prunnerJobId);
$logger = ContentReleaseLogger::fromConsoleOutput($this->output, $contentReleaseIdentifier);
$this->redisContentReleaseService->registerManualTransferJob($contentReleaseIdentifier, $prunnerJobId, $logger);
}
public function flushContentCacheIfRequiredCommand(string $contentReleaseIdentifier, bool $flushContentCache = false): void
{
$logger = ContentReleaseLogger::fromConsoleOutput($this->output, ContentReleaseIdentifier::fromString($contentReleaseIdentifier));
if (!$flushContentCache) {
$logger->info('Not flushing content cache');
return;
}
$logger->info('Flushing content cache');
$this->contentCache->flush();
}
}