public function deployWebapps()
{
// iterate over the deploy directories and deploy all archives
/** @var \AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode */
foreach ($this->getService()->getSystemConfiguration()->getContainers() as $containerNode) {
// check if deploy dir exists
if (is_dir($deployDir = $this->getService()->getBaseDirectory($containerNode->getHost()->getDeployBase()))) {
// init file iterator on deployment directory
$fileIterator = new \FilesystemIterator($deployDir);
// Iterate through all phar files and extract them to tmp dir
foreach (new \RegexIterator($fileIterator, '/^.*\\' . $this->getExtensionSuffix() . '$/') as $archive) {
$this->undeployArchive($containerNode, $archive);
$this->deployArchive($containerNode, $archive);
}
}
// prepare the filename for the file with the last successful deployment timestamp
$successFile = sprintf('%s/%s', $deployDir, ExtractorInterface::FILE_DEPLOYMENT_SUCCESSFULL);
// create a flag file with date of the last successful deployment
touch($successFile);
}
}