New symlink flag set by the compiler, new compile with symlinks checkbox in the setup (#190)

The flag consists of the new `data/.compilation-symlinks` file, which is included in the code base (but not available in the Combodo packages).

It will be used and generated if and only if : 
* we are on a dev env (`\utils::IsDevelopmentEnvironment`)
* the `symlink` PHP function exists

The flag is generated low level in the compiler (\MFCompiler::DoCompile)

In the setup, if the flag is present and all conditions are met then a new option will be displayed in the "Miscellaneous Parameters" wizard step. When unchecking/checking the flag will be updated accordingly by an ajax query.

All other compiler consumers (Designer / Hub connectors, Core Update, scripts using `RunTimeEnvironment` class) will : 
* if they provide a value for the symlink option, it will be used
* otherwise the flag will be used instead, if conditions are met
This commit is contained in:
Pierre Goiffon
2021-06-14 16:44:34 +02:00
committed by GitHub
parent d8e2a1cc7c
commit c417a454d6
8 changed files with 157 additions and 74 deletions

View File

@@ -164,23 +164,27 @@ try
/** @var WizardStep $oStep */
$oStep = new $sClass($oDummyController, $sState);
$sConfigFile = utils::GetConfigFilePath();
if (file_exists($sConfigFile) && !is_writable($sConfigFile) && $oStep->RequiresWritableConfig())
{
if (file_exists($sConfigFile) && !is_writable($sConfigFile) && $oStep->RequiresWritableConfig()) {
$sRelativePath = utils::GetConfigFilePathRelative();
$oPage->error("<b>Error:</b> the configuration file '".$sRelativePath."' already exists and cannot be overwritten.");
$oPage->p("The wizard cannot modify the configuration file for you. If you want to upgrade ".ITOP_APPLICATION.", make sure that the file '<b>".$sRelativePath."</b>' can be modified by the web server.");
$oPage->output();
}
else
{
} else {
$oStep->AsyncAction($oPage, $sActionCode, $aParams);
}
}
$oPage->output();
break;
$oPage->output();
break;
case 'toggle_use_symbolic_links':
$sUseSymbolicLinks = Utils::ReadParam('bUseSymbolicLinks', false);
$bUseSymbolicLinks = ($sUseSymbolicLinks === 'true');
MFCompiler::SetUseSymbolicLinksFlag($bUseSymbolicLinks);
echo "toggle useSymbolicLInks file : $bUseSymbolicLinks";
break;
default:
throw(new Exception("Error unsupported operation '$sOperation'"));
throw(new Exception("Error unsupported operation '$sOperation'"));
}
}
catch(Exception $e)