1414use Flowpack \DecoupledContentStore \PrepareContentRelease \Infrastructure \RedisContentReleaseService ;
1515use Flowpack \DecoupledContentStore \Utility \GeneratorUtility ;
1616use Neos \ContentRepository \Domain \Model \NodeInterface ;
17- use Neos \ContentRepository \Domain \NodeType \NodeTypeConstraintFactory ;
18- use Neos \ContentRepository \Domain \NodeType \NodeTypeName ;
19- use Neos \ContentRepository \Domain \Utility \NodePaths ;
2017use Neos \Eel \FlowQuery \FlowQuery ;
2118use Neos \Flow \Annotations as Flow ;
2219use Neos \Neos \Domain \Model \Site ;
2320
2421class NodeEnumerator
2522{
26- /**
27- * @Flow\Inject
28- * @var NodeTypeConstraintFactory
29- */
30- protected $ nodeTypeConstraintFactory ;
3123
3224 /**
3325 * @Flow\Inject
@@ -79,9 +71,16 @@ private function enumerateAll(?Site $site, ContentReleaseLogger $contentReleaseL
7971 {
8072 $ combinator = new NodeContextCombinator ();
8173
82- $ nodeTypeWhitelist = $ this ->nodeTypeConstraintFactory ->parseFilterString ($ this ->nodeTypeWhitelist );
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 ));
8382
84- $ queueSite = function (Site $ site ) use ($ combinator , $ nodeTypeWhitelist , $ contentReleaseLogger , $ workspaceName ) {
83+ $ queueSite = static function (Site $ site ) use ($ combinator , $ nodeTypeFilter , $ contentReleaseLogger , $ workspaceName ) {
8584 $ contentReleaseLogger ->debug ('Publishing site ' , [
8685 'name ' => $ site ->getName (),
8786 'domain ' => $ site ->getFirstActiveDomain ()
@@ -94,24 +93,15 @@ private function enumerateAll(?Site $site, ContentReleaseLogger $contentReleaseL
9493 'dimensionValues ' => $ dimensionValues
9594 ]);
9695
97- // Build filter from white listed nodetypes
98- $ nodeTypeWhitelist = explode (', ' , $ this ->nodeTypeWhitelist ?: 'Neos.Neos:Document ' );
99- $ nodeTypeFilter = implode (', ' , array_map (static function ($ nodeType ) {
100- if ($ nodeType [0 ] === '! ' ) {
101- return '[!instanceof ' . substr ($ nodeType , 1 ) . '] ' ;
102- }
103- return '[instanceof ' . $ nodeType . '] ' ;
104- }, $ nodeTypeWhitelist ));
105-
106- $ documentQuery = new FlowQuery ([$ siteNode ]);
107- /** @var NodeInterface[] $documents */
108- $ documents = $ documentQuery ->find ($ nodeTypeFilter )->add ($ siteNode )->get ();
96+ $ nodeQuery = new FlowQuery ([$ siteNode ]);
97+ /** @var NodeInterface[] $matchingNodes */
98+ $ matchingNodes = $ nodeQuery ->find ($ nodeTypeFilter )->add ($ siteNode )->get ();
10999
110- foreach ($ documents as $ documentNode ) {
111- $ contextPath = $ documentNode ->getContextPath ();
100+ foreach ($ matchingNodes as $ nodeToEnumerate ) {
101+ $ contextPath = $ nodeToEnumerate ->getContextPath ();
112102
113103 // Verify that the node is not orphaned
114- $ parentNode = $ documentNode ->getParent ();
104+ $ parentNode = $ nodeToEnumerate ->getParent ();
115105 while ($ parentNode !== $ siteNode ) {
116106 if ($ parentNode === null ) {
117107 $ contentReleaseLogger ->debug ('Skipping node from publishing, because it is orphaned ' , [
@@ -123,28 +113,24 @@ private function enumerateAll(?Site $site, ContentReleaseLogger $contentReleaseL
123113 $ parentNode = $ parentNode ->getParent ();
124114 }
125115
126- if (!$ documentNode ->getParent ()) {
127- $ contentReleaseLogger ->debug ('Skipping node from publishing, because it is orphaned ' , [
128- 'node ' => $ contextPath ,
129- ]);
130- } else if ($ documentNode ->isHidden ()) {
116+ if ($ nodeToEnumerate ->isHidden ()) {
131117 $ contentReleaseLogger ->debug ('Skipping node from publishing, because it is hidden ' , [
132118 'node ' => $ contextPath ,
133119 ]);
134120 } else {
135121 $ contentReleaseLogger ->debug ('Registering node for publishing ' , [
136122 'node ' => $ contextPath
137123 ]);
138- yield EnumeratedNode::fromNode ($ documentNode );
124+ yield EnumeratedNode::fromNode ($ nodeToEnumerate );
139125 }
140126 }
141127 }
142128 $ contentReleaseLogger ->debug (sprintf ('Finished enumerating site %s in %dms ' , $ site ->getName (), (microtime (true ) - $ startTime ) * 1000 ));
143129 };
144130
145131 if ($ site === null ) {
146- foreach ($ combinator ->sites () as $ site ) {
147- yield from $ queueSite ($ site );
132+ foreach ($ combinator ->sites () as $ siteInList ) {
133+ yield from $ queueSite ($ siteInList );
148134 }
149135 } else {
150136 yield from $ queueSite ($ site );
0 commit comments