1414use Flowpack \DecoupledContentStore \PrepareContentRelease \Infrastructure \RedisContentReleaseService ;
1515use Flowpack \DecoupledContentStore \Utility \GeneratorUtility ;
1616use Neos \ContentRepository \Domain \Model \NodeInterface ;
17+ use Neos \Eel \Exception ;
1718use Neos \Eel \FlowQuery \FlowQuery ;
1819use Neos \Flow \Annotations as Flow ;
1920use Neos \Neos \Domain \Model \Site ;
@@ -43,19 +44,34 @@ class NodeEnumerator
4344 * @Flow\InjectConfiguration("nodeRendering.nodeTypeWhitelist")
4445 * @var string
4546 */
46- protected $ nodeTypeWhitelist ;
47-
48- public function enumerateAndStoreInRedis (?Site $ site , ContentReleaseLogger $ contentReleaseLogger , ContentReleaseIdentifier $ releaseIdentifier ): void
49- {
50- $ contentReleaseLogger ->info ('Starting content release ' , ['contentReleaseIdentifier ' => $ releaseIdentifier ->jsonSerialize ()]);
47+ protected $ nodeTypeList ;
48+
49+ public function enumerateAndStoreInRedis (
50+ ?Site $ site ,
51+ ContentReleaseLogger $ contentReleaseLogger ,
52+ ContentReleaseIdentifier $ releaseIdentifier
53+ ): void {
54+ $ contentReleaseLogger ->info (
55+ 'Starting content release ' ,
56+ ['contentReleaseIdentifier ' => $ releaseIdentifier ->jsonSerialize ()]
57+ );
5158
5259 // set content release status to running
5360 $ currentMetadata = $ this ->redisContentReleaseService ->fetchMetadataForContentRelease ($ releaseIdentifier );
5461 $ newMetadata = $ currentMetadata ->withStatus (NodeRenderingCompletionStatus::running ());
55- $ this ->redisContentReleaseService ->setContentReleaseMetadata ($ releaseIdentifier , $ newMetadata , RedisInstanceIdentifier::primary ());
62+ $ this ->redisContentReleaseService ->setContentReleaseMetadata (
63+ $ releaseIdentifier ,
64+ $ newMetadata ,
65+ RedisInstanceIdentifier::primary ()
66+ );
5667
5768 $ this ->redisEnumerationRepository ->clearDocumentNodesEnumeration ($ releaseIdentifier );
58- foreach (GeneratorUtility::createArrayBatch ($ this ->enumerateAll ($ site , $ contentReleaseLogger , $ newMetadata ->getWorkspaceName ()), 100 ) as $ enumeration ) {
69+ foreach (
70+ GeneratorUtility::createArrayBatch (
71+ $ this ->enumerateAll ($ site , $ contentReleaseLogger , $ newMetadata ->getWorkspaceName ()),
72+ 100
73+ ) as $ enumeration
74+ ) {
5975 $ this ->concurrentBuildLockService ->assertNoOtherContentReleaseWasStarted ($ releaseIdentifier );
6076 // $enumeration is an array of EnumeratedNode, with at most 100 elements in it.
6177 // TODO: EXTENSION POINT HERE, TO ADD ADDITIONAL ENUMERATIONS (.metadata.json f.e.)
@@ -66,21 +82,33 @@ public function enumerateAndStoreInRedis(?Site $site, ContentReleaseLogger $cont
6682
6783 /**
6884 * @return iterable<EnumeratedNode>
85+ * @throws Exception
6986 */
70- private function enumerateAll (?Site $ site , ContentReleaseLogger $ contentReleaseLogger , string $ workspaceName ): iterable
71- {
87+ private function enumerateAll (
88+ ?Site $ site ,
89+ ContentReleaseLogger $ contentReleaseLogger ,
90+ string $ workspaceName
91+ ): iterable {
7292 $ combinator = new NodeContextCombinator ();
7393
74- // Build filter from white listed nodetypes
75- $ nodeTypeWhitelist = explode (', ' , $ this ->nodeTypeWhitelist ?: 'Neos.Neos:Document ' );
76- $ nodeTypeFilter = implode (', ' , array_map (static function ($ nodeType ) {
77- if ($ nodeType [0 ] === '! ' ) {
78- return '[!instanceof ' . substr ($ nodeType , 1 ) . '] ' ;
79- }
80- return '[instanceof ' . $ nodeType . '] ' ;
81- }, $ nodeTypeWhitelist ));
82-
83- $ queueSite = static function (Site $ site ) use ($ combinator , $ nodeTypeFilter , $ contentReleaseLogger , $ workspaceName ) {
94+ // Build filter from allowed/disallowed nodetypes
95+ $ nodeTypeList = explode (', ' , $ this ->nodeTypeList ?: 'Neos.Neos:Document ' );
96+ $ nodeTypeFilter = implode (
97+ ', ' ,
98+ array_map (static function ($ nodeType ) {
99+ if ($ nodeType [0 ] === '! ' ) {
100+ return '[!instanceof ' . substr ($ nodeType , 1 ) . '] ' ;
101+ }
102+ return '[instanceof ' . $ nodeType . '] ' ;
103+ }, $ nodeTypeList )
104+ );
105+
106+ $ queueSite = static function (Site $ site ) use (
107+ $ combinator ,
108+ $ nodeTypeFilter ,
109+ $ contentReleaseLogger ,
110+ $ workspaceName
111+ ) {
84112 $ contentReleaseLogger ->debug ('Publishing site ' , [
85113 'name ' => $ site ->getName (),
86114 'domain ' => $ site ->getFirstActiveDomain ()
@@ -125,7 +153,9 @@ private function enumerateAll(?Site $site, ContentReleaseLogger $contentReleaseL
125153 }
126154 }
127155 }
128- $ contentReleaseLogger ->debug (sprintf ('Finished enumerating site %s in %dms ' , $ site ->getName (), (microtime (true ) - $ startTime ) * 1000 ));
156+ $ contentReleaseLogger ->debug (
157+ sprintf ('Finished enumerating site %s in %dms ' , $ site ->getName (), (microtime (true ) - $ startTime ) * 1000 )
158+ );
129159 };
130160
131161 if ($ site === null ) {
0 commit comments