public static function initializeProxyClasses(Bootstrap $bootstrap)
{
$objectConfigurationCache = $bootstrap->getEarlyInstance(CacheManager::class)->getCache('Flow_Object_Configuration');
$configurationManager = $bootstrap->getEarlyInstance(ConfigurationManager::class);
$settings = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow');
// The compile sub command will only be run if the code cache is completely empty:
if ($objectConfigurationCache->has('allCompiledCodeUpToDate') === false) {
OpcodeCacheHelper::clearAllActive(FLOW_PATH_CONFIGURATION);
OpcodeCacheHelper::clearAllActive(FLOW_PATH_DATA);
self::executeCommand('neos.flow:core:compile', $settings);
if (isset($settings['persistence']['doctrine']['enable']) && $settings['persistence']['doctrine']['enable'] === true) {
self::compileDoctrineProxies($bootstrap);
}
// As the available proxy classes were already loaded earlier we need to refresh them if the proxies where recompiled.
$classLoader = $bootstrap->getEarlyInstance(ClassLoader::class);
$classLoader->initializeAvailableProxyClasses($bootstrap->getContext());
}
// Check if code was updated, if not something went wrong
if ($objectConfigurationCache->has('allCompiledCodeUpToDate') === false) {
if (DIRECTORY_SEPARATOR === '/') {
$phpBinaryPathAndFilename = '"' . escapeshellcmd(Files::getUnixStylePath($settings['core']['phpBinaryPathAndFilename'])) . '"';
} else {
$phpBinaryPathAndFilename = escapeshellarg(Files::getUnixStylePath($settings['core']['phpBinaryPathAndFilename']));
}
$command = sprintf('%s -c %s -v', $phpBinaryPathAndFilename, escapeshellarg(php_ini_loaded_file()));
exec($command, $output, $result);
if ($result !== 0) {
if (!file_exists($phpBinaryPathAndFilename)) {
throw new FlowException(sprintf('It seems like the PHP binary "%s" cannot be executed by Flow. Set the correct path to the PHP executable in Configuration/Settings.yaml, setting Neos.Flow.core.phpBinaryPathAndFilename.', $settings['core']['phpBinaryPathAndFilename']), 1315561483);
}
throw new FlowException(sprintf('It seems like the PHP binary "%s" cannot be executed by Flow. The command executed was "%s" and returned the following: %s', $settings['core']['phpBinaryPathAndFilename'], $command, PHP_EOL . implode(PHP_EOL, $output)), 1354704332);
}
echo PHP_EOL . 'Flow: The compile run failed. Please check the error output or system log for more information.' . PHP_EOL;
exit(1);
}
}