Skip to content
Snippets Groups Projects

Fixes bugs when path count is > 1

Open Oscar Merida requested to merge issue/tome-3478842:3478842-pths-are-exported into 8.x-1.x
3 files
+ 21
3
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -53,6 +53,8 @@ class StaticCommand extends CommandBase {
*/
protected $state;
protected $init_paths = [];
/**
* Constructs a StaticCommand instance.
*
@@ -123,6 +125,9 @@ class StaticCommand extends CommandBase {
}
$this->io->writeln('Generating static HTML...');
$this->setInitialPaths($paths);
$this->exportPaths($paths, [], $options['process-count'], $options['path-count'], TRUE, $options['retry-count'], $options['uri']);
$this->io->success('Exported static HTML and related assets.');
@@ -135,6 +140,14 @@ class StaticCommand extends CommandBase {
return 0;
}
protected function setInitialPaths(array $paths): void {
$this->init_paths = $paths;
}
protected function getInitialPaths(): array {
return $this->init_paths;
}
/**
* Exports the given paths to the static directory.
*
@@ -175,15 +188,18 @@ class StaticCommand extends CommandBase {
$show_progress && $this->io->progressStart(count($paths));
$invoke_paths = [];
$collected_errors = $this->runCommands($commands, $process_count, $retry_count, function (Process $process) use ($show_progress, &$invoke_paths, $path_count) {
$collected_errors = $this->runCommands($commands, $process_count, $retry_count, function (Process $process) use ($show_progress, &$invoke_paths, $path_count, $old_paths) {
$show_progress && $this->io->progressAdvance($path_count);
$output = $process->getOutput();
if (!empty($output) && $json = json_decode($output, TRUE)) {
$invoke_paths = array_merge($invoke_paths, $json);
// don't include paths that are going to be exported by another process
$invoke_paths = array_diff($invoke_paths, $old_paths, $this->getInitialPaths());
}
});
$invoke_paths = array_diff($invoke_paths, $old_paths);
$invoke_paths = array_diff($invoke_paths, $old_paths, $this->getInitialPaths());
$old_paths = array_merge($old_paths, $invoke_paths);
$show_progress && $this->io->progressFinish();
@@ -191,6 +207,7 @@ class StaticCommand extends CommandBase {
$this->displayErrors($collected_errors);
}
if (count($invoke_paths)) {
$this->init_paths = array_merge($this->init_paths, $invoke_paths);
$this->io->writeln('Processing related assets and paths...');
$this->exportPaths($invoke_paths, $old_paths, $process_count, $path_count, $show_progress, $retry_count, $uri);
}
Loading