@@ -133,44 +133,6 @@ class NodeIndexCommandController extends CommandController
133133 */
134134 protected $ workspaceIndexer ;
135135
136- /**
137- * Print out the complete mapping for all node types
138- *
139- * @throws \Flowpack\ElasticSearch\ContentRepositoryAdaptor\Exception
140- * @throws \Flowpack\ElasticSearch\Exception
141- */
142- public function showMappingCommand (): void
143- {
144- $ nodeTypeMappingCollection = $ this ->nodeTypeMappingBuilder ->buildMappingInformation ($ this ->nodeIndexer ->getIndex ());
145-
146- foreach ($ nodeTypeMappingCollection as $ mapping ) {
147- /** @var Mapping $mapping */
148- $ this ->output (Yaml::dump ($ mapping ->asArray (), 5 , 2 ));
149- $ this ->outputLine ();
150- }
151-
152- $ this ->outputLine ('------------ ' );
153-
154- $ mappingErrors = $ this ->nodeTypeMappingBuilder ->getLastMappingErrors ();
155- if ($ mappingErrors ->hasErrors ()) {
156- $ this ->outputLine ('<b>Mapping Errors</b> ' );
157- foreach ($ mappingErrors ->getFlattenedErrors () as $ errors ) {
158- foreach ($ errors as $ error ) {
159- $ this ->outputLine ($ error );
160- }
161- }
162- }
163-
164- if ($ mappingErrors ->hasWarnings ()) {
165- $ this ->outputLine ('<b>Mapping Warnings</b> ' );
166- foreach ($ mappingErrors ->getFlattenedWarnings () as $ warnings ) {
167- foreach ($ warnings as $ warning ) {
168- $ this ->outputLine ((string )$ warning );
169- }
170- }
171- }
172- }
173-
174136 /**
175137 * Index a single node by the given identifier and workspace name
176138 *
@@ -293,19 +255,19 @@ public function buildCommand(int $limit = null, bool $update = false, string $wo
293255
294256 $ combinations = new ArrayCollection ($ this ->contentDimensionCombinator ->getAllAllowedCombinations ());
295257
296- $ this ->outputSection ('Create indicies ... ' );
297- $ combinations ->map ($ create );
298-
299- $ this ->outputSection ('Indexing nodes ... ' );
300- $ combinations ->map ($ build );
301-
302- $ this ->outputSection ('Refresh indicies ... ' );
303- $ combinations ->map ($ refresh );
258+ $ runAndLog = function ($ command , string $ stepInfo ) use ($ combinations ) {
259+ $ timeStart = microtime (true );
260+ $ this ->output (str_pad ($ stepInfo . '... ' , 20 ));
261+ $ combinations ->map ($ command );
262+ $ this ->outputLine ('<success>Done</success> (took %s seconds) ' , [number_format (microtime (true ) - $ timeStart , 2 )]);
263+ };
304264
305- $ this ->outputSection ('Update aliases ... ' );
306- $ combinations ->map ($ updateAliases );
265+ $ runAndLog ($ create , 'Create indicies ' );
266+ $ runAndLog ($ build , 'Indexing nodes ' );
267+ $ runAndLog ($ refresh , 'Refresh indicies ' );
268+ $ runAndLog ($ updateAliases , 'Update aliases ' );
307269
308- $ this ->outputSection ('Update main alias ' );
270+ $ this ->outputLine ('Update main alias ' );
309271 $ this ->nodeIndexer ->updateMainAlias ();
310272
311273 $ this ->outputLine ();
@@ -319,7 +281,6 @@ public function buildCommand(int $limit = null, bool $update = false, string $wo
319281 * @param string $postfix
320282 * @param string $workspace
321283 * @param int $limit
322- * @Flow\Internal
323284 * @throws Exception
324285 */
325286 private function build (array $ dimensionsValues , ?string $ workspace = null , ?string $ postfix = null , ?int $ limit = null ): void
@@ -351,7 +312,6 @@ private function build(array $dimensionsValues, ?string $workspace = null, ?stri
351312 }
352313
353314 $ outputArray = explode (PHP_EOL , $ output );
354- $ count = (int )array_pop ($ outputArray );
355315 if (count ($ outputArray ) > 0 ) {
356316 foreach ($ outputArray as $ line ) {
357317 $ line = trim ($ line );
@@ -597,12 +557,4 @@ private function outputMemoryUsage(): void
597557 {
598558 $ this ->outputLine ('! Memory usage %s ' , [Files::bytesToSizeString (memory_get_usage (true ))]);
599559 }
600-
601- /**
602- * @param string $title
603- */
604- private function outputSection (string $ title ): void
605- {
606- $ this ->outputLine ('<b>%s</b> ' , [$ title ]);
607- }
608560}
0 commit comments