Skip to content

Commit de4b3a3

Browse files
authored
Merge pull request #108 from php-etl/fix/clear-workflow-pipelines
delete old pipelines when building a workflow
2 parents 57b0c17 + a94306c commit de4b3a3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Adapter/Filesystem/SatelliteBuilder.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,21 @@ public function build(): Configurator\SatelliteInterface
162162

163163
$satellite->dependsOn(...$this->composerRequire);
164164

165+
$this->clearPipelines();
166+
165167
return $satellite;
166168
}
169+
170+
private function clearPipelines(): void
171+
{
172+
$iterator = new \AppendIterator();
173+
174+
$iterator->append(new \GlobIterator($this->workdir.'/pipeline*.php', \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS));
175+
176+
foreach ($iterator as $file) {
177+
if (is_file($file->getPathname())) {
178+
unlink($file->getPathname());
179+
}
180+
}
181+
}
167182
}

0 commit comments

Comments
 (0)