mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 23:32:17 +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', []);
|
$aSelectedModules = $this->oParams->Get('selected_modules', []);
|
||||||
$sSourceDir = $this->oParams->Get('source_dir', 'datamodels/latest');
|
$sSourceDir = $this->oParams->Get('source_dir', 'datamodels/latest');
|
||||||
$sExtensionDir = $this->oParams->Get('extensions_dir', 'extensions');
|
$sExtensionDir = $this->oParams->Get('extensions_dir', 'extensions');
|
||||||
$aMiscOptions = $this->oParams->Get('options', []);
|
|
||||||
$aRemovedExtensionCodes = $this->oParams->Get('removed_extensions', []);
|
$aRemovedExtensionCodes = $this->oParams->Get('removed_extensions', []);
|
||||||
$bUseSymbolicLinks = $aMiscOptions['symlinks'] ?? false;
|
$bUseSymbolicLinks = $this->oParams->Get('use_symbolic_links', null) === 'on';
|
||||||
$sMessage = $bUseSymbolicLinks ? '' : 'Using symbolic links instead of copying data model files (for developers only!)';
|
$sMessage = $bUseSymbolicLinks ? 'Using symbolic links instead of copying data model files (for developers only!)' : '';
|
||||||
$this->oRunTimeEnvironment->DoCompile(
|
$this->oRunTimeEnvironment->DoCompile(
|
||||||
$aRemovedExtensionCodes,
|
$aRemovedExtensionCodes,
|
||||||
$aSelectedModules,
|
$aSelectedModules,
|
||||||
|
|||||||
@@ -847,14 +847,19 @@ class SetupUtils
|
|||||||
// Skip
|
// Skip
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (is_dir($sSource.'/'.$sFile)) {
|
$sSourcePath = $sSource.'/'.$sFile;
|
||||||
|
$sDestPath = $sDest.'/'.$sFile;
|
||||||
|
if (is_dir($sSourcePath)) {
|
||||||
// Recurse
|
// Recurse
|
||||||
self::copydir($sSource.'/'.$sFile, $sDest.'/'.$sFile, $bUseSymbolicLinks);
|
self::copydir($sSourcePath, $sDestPath, $bUseSymbolicLinks);
|
||||||
|
} elseif (is_link($sSourcePath)) {
|
||||||
|
$sLinkPath = readlink($sSourcePath);
|
||||||
|
symlink($sLinkPath, $sDestPath);
|
||||||
} else {
|
} else {
|
||||||
if ($bUseSymbolicLinks) {
|
if ($bUseSymbolicLinks) {
|
||||||
symlink($sSource.'/'.$sFile, $sDest.'/'.$sFile);
|
symlink($sSourcePath, $sDestPath);
|
||||||
} else {
|
} else {
|
||||||
copy($sSource.'/'.$sFile, $sDest.'/'.$sFile);
|
copy($sSourcePath, $sDestPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -863,6 +868,9 @@ class SetupUtils
|
|||||||
} elseif (is_file($sSource)) {
|
} elseif (is_file($sSource)) {
|
||||||
if ($bUseSymbolicLinks) {
|
if ($bUseSymbolicLinks) {
|
||||||
return symlink($sSource, $sDest);
|
return symlink($sSource, $sDest);
|
||||||
|
} elseif (is_link($sSource)) {
|
||||||
|
$sLinkPath = readlink($sSource);
|
||||||
|
return symlink($sLinkPath, $sDest);
|
||||||
} else {
|
} else {
|
||||||
return copy($sSource, $sDest);
|
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
|
'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),
|
'options' => json_decode($this->oWizard->GetParameter('misc_options', '[]'), true),
|
||||||
'mysql_bindir' => $this->oWizard->GetParameter('mysql_bindir'),
|
'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 != '') {
|
if ($sBackupDestination != '') {
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ abstract class AbstractWizStepMiscParams extends WizardStep
|
|||||||
final protected function AddUseSymlinksFlagOption(WebPage $oPage): void
|
final protected function AddUseSymlinksFlagOption(WebPage $oPage): void
|
||||||
{
|
{
|
||||||
if (MFCompiler::CanUseSymbolicLinks()) {
|
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('<fieldset>');
|
||||||
$oPage->add('<legend>Dev parameters</legend>');
|
$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>');
|
$oPage->add('</fieldset>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class WizStepInstallMiscParams extends AbstractWizStepMiscParams
|
|||||||
$this->oWizard->SaveParameter('application_url', '');
|
$this->oWizard->SaveParameter('application_url', '');
|
||||||
$this->oWizard->SaveParameter('graphviz_path', '');
|
$this->oWizard->SaveParameter('graphviz_path', '');
|
||||||
$this->oWizard->SaveParameter('sample_data', 'yes');
|
$this->oWizard->SaveParameter('sample_data', 'yes');
|
||||||
|
$this->oWizard->SaveParameter('use_symbolic_links', false);
|
||||||
return new WizardState(WizStepModulesChoice::class, 'start_install');
|
return new WizardState(WizStepModulesChoice::class, 'start_install');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class WizStepUpgradeMiscParams extends AbstractWizStepMiscParams
|
|||||||
{
|
{
|
||||||
$this->oWizard->SaveParameter('application_url', '');
|
$this->oWizard->SaveParameter('application_url', '');
|
||||||
$this->oWizard->SaveParameter('graphviz_path', '');
|
$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);
|
$this->oWizard->SaveParameter('force-uninstall', false);
|
||||||
return new WizardState(WizStepModulesChoice::class, 'start_upgrade');
|
return new WizardState(WizStepModulesChoice::class, 'start_upgrade');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user