protected function executeProvision(ApplicationInterface $application, ProvisionNode $provisionNode, \SplFileInfo $webappPath)
{
// load the steps from the configuration
$stepNodes = $provisionNode->getInstallation()->getSteps();
if (!is_array($stepNodes)) {
return;
}
// execute all steps found in the configuration
foreach ($stepNodes as $stepNode) {
try {
// create a new reflection class of the step
$reflectionClass = new \ReflectionClass($stepNode->getType());
$step = $reflectionClass->newInstance();
// try to inject the datasource node if available
if ($datasourceNode = $provisionNode->getDatasource()) {
$step->injectDataSourceNode($datasourceNode);
}
// inject all other information
$step->injectStepNode($stepNode);
$step->injectApplication($application);
$step->injectService($this->getService());
$step->injectWebappPath($webappPath->getPathname());
$step->injectInitialContext($this->getInitialContext());
$step->injectPhpExecutable($this->getAbsolutPathToPhpExecutable());
// execute the step finally
$step->start(PTHREADS_INHERIT_NONE | PTHREADS_INHERIT_CONSTANTS);
$step->join();
} catch (\Exception $e) {
$this->getInitialContext()->getSystemLogger()->error($e->__toString());
}
}
}