@@ -79,9 +79,16 @@ private function enumerateAll(?Site $site, ContentReleaseLogger $contentReleaseL
7979 {
8080 $ combinator = new NodeContextCombinator ();
8181
82- $ nodeTypeWhitelist = $ this ->nodeTypeConstraintFactory ->parseFilterString ($ this ->nodeTypeWhitelist );
82+ // Build filter from white listed nodetypes
83+ $ nodeTypeWhitelist = explode (', ' , $ this ->nodeTypeWhitelist ?: 'Neos.Neos:Document ' );
84+ $ nodeTypeFilter = implode (', ' , array_map (static function ($ nodeType ) {
85+ if ($ nodeType [0 ] === '! ' ) {
86+ return '[!instanceof ' . substr ($ nodeType , 1 ) . '] ' ;
87+ }
88+ return '[instanceof ' . $ nodeType . '] ' ;
89+ }, $ nodeTypeWhitelist ));
8390
84- $ queueSite = function (Site $ site ) use ($ combinator , $ nodeTypeWhitelist , $ contentReleaseLogger , $ workspaceName ) {
91+ $ queueSite = static function (Site $ site ) use ($ combinator , $ nodeTypeFilter , $ contentReleaseLogger , $ workspaceName ) {
8592 $ contentReleaseLogger ->debug ('Publishing site ' , [
8693 'name ' => $ site ->getName (),
8794 'domain ' => $ site ->getFirstActiveDomain ()
@@ -94,24 +101,15 @@ private function enumerateAll(?Site $site, ContentReleaseLogger $contentReleaseL
94101 'dimensionValues ' => $ dimensionValues
95102 ]);
96103
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 ();
104+ $ nodeQuery = new FlowQuery ([$ siteNode ]);
105+ /** @var NodeInterface[] $matchingNodes */
106+ $ matchingNodes = $ nodeQuery ->find ($ nodeTypeFilter )->add ($ siteNode )->get ();
109107
110- foreach ($ documents as $ documentNode ) {
111- $ contextPath = $ documentNode ->getContextPath ();
108+ foreach ($ matchingNodes as $ nodeToEnumerate ) {
109+ $ contextPath = $ nodeToEnumerate ->getContextPath ();
112110
113111 // Verify that the node is not orphaned
114- $ parentNode = $ documentNode ->getParent ();
112+ $ parentNode = $ nodeToEnumerate ->getParent ();
115113 while ($ parentNode !== $ siteNode ) {
116114 if ($ parentNode === null ) {
117115 $ contentReleaseLogger ->debug ('Skipping node from publishing, because it is orphaned ' , [
@@ -123,28 +121,24 @@ private function enumerateAll(?Site $site, ContentReleaseLogger $contentReleaseL
123121 $ parentNode = $ parentNode ->getParent ();
124122 }
125123
126- if (!$ documentNode ->getParent ()) {
127- $ contentReleaseLogger ->debug ('Skipping node from publishing, because it is orphaned ' , [
128- 'node ' => $ contextPath ,
129- ]);
130- } else if ($ documentNode ->isHidden ()) {
124+ if ($ nodeToEnumerate ->isHidden ()) {
131125 $ contentReleaseLogger ->debug ('Skipping node from publishing, because it is hidden ' , [
132126 'node ' => $ contextPath ,
133127 ]);
134128 } else {
135129 $ contentReleaseLogger ->debug ('Registering node for publishing ' , [
136130 'node ' => $ contextPath
137131 ]);
138- yield EnumeratedNode::fromNode ($ documentNode );
132+ yield EnumeratedNode::fromNode ($ nodeToEnumerate );
139133 }
140134 }
141135 }
142136 $ contentReleaseLogger ->debug (sprintf ('Finished enumerating site %s in %dms ' , $ site ->getName (), (microtime (true ) - $ startTime ) * 1000 ));
143137 };
144138
145139 if ($ site === null ) {
146- foreach ($ combinator ->sites () as $ site ) {
147- yield from $ queueSite ($ site );
140+ foreach ($ combinator ->sites () as $ siteInList ) {
141+ yield from $ queueSite ($ siteInList );
148142 }
149143 } else {
150144 yield from $ queueSite ($ site );
0 commit comments