mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 22:39:03 +02:00
N°9503 Fix broken symlink in setup wizard (#881)
This commit is contained in:
@@ -53,10 +53,9 @@ class DataAuditSequencer extends StepSequencer
|
||||
$aSelectedModules = $this->oParams->Get('selected_modules', []);
|
||||
$sSourceDir = $this->oParams->Get('source_dir', 'datamodels/latest');
|
||||
$sExtensionDir = $this->oParams->Get('extensions_dir', 'extensions');
|
||||
$aMiscOptions = $this->oParams->Get('options', []);
|
||||
$aRemovedExtensionCodes = $this->oParams->Get('removed_extensions', []);
|
||||
$bUseSymbolicLinks = $aMiscOptions['symlinks'] ?? false;
|
||||
$sMessage = $bUseSymbolicLinks ? '' : 'Using symbolic links instead of copying data model files (for developers only!)';
|
||||
$bUseSymbolicLinks = $this->oParams->Get('use_symbolic_links', null) === 'on';
|
||||
$sMessage = $bUseSymbolicLinks ? 'Using symbolic links instead of copying data model files (for developers only!)' : '';
|
||||
$this->oRunTimeEnvironment->DoCompile(
|
||||
$aRemovedExtensionCodes,
|
||||
$aSelectedModules,
|
||||
|
||||
@@ -847,14 +847,19 @@ class SetupUtils
|
||||
// Skip
|
||||
continue;
|
||||
}
|
||||
if (is_dir($sSource.'/'.$sFile)) {
|
||||
$sSourcePath = $sSource.'/'.$sFile;
|
||||
$sDestPath = $sDest.'/'.$sFile;
|
||||
if (is_dir($sSourcePath)) {
|
||||
// Recurse
|
||||
self::copydir($sSource.'/'.$sFile, $sDest.'/'.$sFile, $bUseSymbolicLinks);
|
||||
self::copydir($sSourcePath, $sDestPath, $bUseSymbolicLinks);
|
||||
} elseif (is_link($sSourcePath)) {
|
||||
$sLinkPath = readlink($sSourcePath);
|
||||
symlink($sLinkPath, $sDestPath);
|
||||
} else {
|
||||
if ($bUseSymbolicLinks) {
|
||||
symlink($sSource.'/'.$sFile, $sDest.'/'.$sFile);
|
||||
symlink($sSourcePath, $sDestPath);
|
||||
} else {
|
||||
copy($sSource.'/'.$sFile, $sDest.'/'.$sFile);
|
||||
copy($sSourcePath, $sDestPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -863,6 +868,9 @@ class SetupUtils
|
||||
} elseif (is_file($sSource)) {
|
||||
if ($bUseSymbolicLinks) {
|
||||
return symlink($sSource, $sDest);
|
||||
} elseif (is_link($sSource)) {
|
||||
$sLinkPath = readlink($sSource);
|
||||
return symlink($sLinkPath, $sDest);
|
||||
} else {
|
||||
return copy($sSource, $sDest);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ abstract class AbstractWizStepInstall extends WizardStep
|
||||
'old_addon' => $this->oWizard->GetParameter('old_addon', false), // whether or not to use the "old" userrights profile addon
|
||||
'options' => json_decode($this->oWizard->GetParameter('misc_options', '[]'), true),
|
||||
'mysql_bindir' => $this->oWizard->GetParameter('mysql_bindir'),
|
||||
'use-symbolic-links' => $this->oWizard->GetParameter('use-symbolic-links', MFCompiler::UseSymbolicLinks()),
|
||||
'use_symbolic_links' => $this->oWizard->GetParameter('use_symbolic_links', MFCompiler::UseSymbolicLinks()),
|
||||
];
|
||||
|
||||
if ($sBackupDestination != '') {
|
||||
|
||||
@@ -31,11 +31,11 @@ abstract class AbstractWizStepMiscParams extends WizardStep
|
||||
final protected function AddUseSymlinksFlagOption(WebPage $oPage): void
|
||||
{
|
||||
if (MFCompiler::CanUseSymbolicLinks()) {
|
||||
$sChecked = $this->oWizard->GetParameter('use-symbolic-links', MFCompiler::UseSymbolicLinks()) ? ' checked ' : '';
|
||||
$sChecked = $this->oWizard->GetParameter('use_symbolic_links', MFCompiler::UseSymbolicLinks()) ? ' checked ' : '';
|
||||
|
||||
$oPage->add('<fieldset>');
|
||||
$oPage->add('<legend>Dev parameters</legend>');
|
||||
$oPage->p('<input id="use-symbolic-links" name="use-symbolic-links" type="checkbox"'.$sChecked.'><label for="use-symbolic-links"> Create symbolic links instead of creating a copy in env-production (useful for debugging extensions)');
|
||||
$oPage->p('<input id="use_symbolic_links" name="use_symbolic_links" type="checkbox"'.$sChecked.'><label for="use_symbolic_links"> Create symbolic links instead of creating a copy in env-production (useful for debugging extensions)');
|
||||
$oPage->add('</fieldset>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ class WizStepInstallMiscParams extends AbstractWizStepMiscParams
|
||||
$this->oWizard->SaveParameter('application_url', '');
|
||||
$this->oWizard->SaveParameter('graphviz_path', '');
|
||||
$this->oWizard->SaveParameter('sample_data', 'yes');
|
||||
$this->oWizard->SaveParameter('use_symbolic_links', false);
|
||||
return new WizardState(WizStepModulesChoice::class, 'start_install');
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class WizStepUpgradeMiscParams extends AbstractWizStepMiscParams
|
||||
{
|
||||
$this->oWizard->SaveParameter('application_url', '');
|
||||
$this->oWizard->SaveParameter('graphviz_path', '');
|
||||
$this->oWizard->SaveParameter('use-symbolic-links', MFCompiler::UseSymbolicLinks());
|
||||
$this->oWizard->SaveParameter('use_symbolic_links', false);
|
||||
$this->oWizard->SaveParameter('force-uninstall', false);
|
||||
return new WizardState(WizStepModulesChoice::class, 'start_upgrade');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user