diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index 76310d49b..c2bc78ec1 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -187,19 +187,6 @@ class MFCompiler return $this->aLog; } - /** - * @return bool if flag is present true, false otherwise - * - * @uses \file_exists() - * @uses USE_SYMBOLIC_LINKS_FILE_PATH - * - * @since 3.0.0 N°4092 - */ - public static function IsUseSymbolicLinksFlagPresent(): bool - { - return (file_exists(static::USE_SYMBOLIC_LINKS_FILE_PATH)); - } - /** * This is to check if the functionality can be used. As this is really only useful for developers, * this is strictly limited and not available on any iTop instance ! @@ -214,17 +201,22 @@ class MFCompiler * * @since 3.0.0 N°4092 */ - public static function CanUseSymbolicLinksFlagBeUsed(): bool + public static function CanUseSymbolicLinks(): bool { - if (false === utils::IsDevelopmentEnvironment()) { - return false; - } + return utils::IsDevelopmentEnvironment(); + } - if (false === function_exists('symlink')) { - return false; - } - - return true; + /** + * @return bool if flag is present true, false otherwise + * + * @uses \file_exists() + * @uses USE_SYMBOLIC_LINKS_FILE_PATH + * + * @since 3.0.0 N°4092 + */ + public static function UseSymbolicLinks(): bool + { + return (file_exists(static::USE_SYMBOLIC_LINKS_FILE_PATH)); } /** @@ -236,7 +228,7 @@ class MFCompiler */ public static function SetUseSymbolicLinksFlag(bool $bUseSymbolicLinks): void { - $bIsUseSymlinksFlagPresent = (static::IsUseSymbolicLinksFlagPresent()); + $bIsUseSymlinksFlagPresent = self::UseSymbolicLinks(); if ($bUseSymbolicLinks) { if ($bIsUseSymlinksFlagPresent) { @@ -283,7 +275,7 @@ class MFCompiler { if (is_null($bUseSymbolicLinks)) { $bUseSymbolicLinks = false; - if (self::CanUseSymbolicLinksFlagBeUsed() && self::IsUseSymbolicLinksFlagPresent()) { + if (self::CanUseSymbolicLinks() && self::UseSymbolicLinks()) { // We are only overriding the useSymLinks option if the consumer didn't specify anything // The toolkit always send this parameter for example, but not the Designer Connector $bUseSymbolicLinks = true; diff --git a/setup/wizardsteps/AbstractWizStepInstall.php b/setup/wizardsteps/AbstractWizStepInstall.php index 31ec559c9..92bbbbe05 100644 --- a/setup/wizardsteps/AbstractWizStepInstall.php +++ b/setup/wizardsteps/AbstractWizStepInstall.php @@ -98,6 +98,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()), ]; if ($sBackupDestination != '') { diff --git a/setup/wizardsteps/AbstractWizStepMiscParams.php b/setup/wizardsteps/AbstractWizStepMiscParams.php index e50181eb3..f62263ab2 100644 --- a/setup/wizardsteps/AbstractWizStepMiscParams.php +++ b/setup/wizardsteps/AbstractWizStepMiscParams.php @@ -17,6 +17,7 @@ * * You should have received a copy of the GNU Affero General Public License */ + use Combodo\iTop\Application\WebPage\WebPage; /** @@ -29,24 +30,13 @@ abstract class AbstractWizStepMiscParams extends WizardStep */ final protected function AddUseSymlinksFlagOption(WebPage $oPage): void { - if (MFCompiler::CanUseSymbolicLinksFlagBeUsed()) { - $sChecked = (MFCompiler::IsUseSymbolicLinksFlagPresent()) ? ' checked' : ''; + if (MFCompiler::CanUseSymbolicLinks()) { + $sChecked = $this->oWizard->GetParameter('use-symbolic-links', MFCompiler::UseSymbolicLinks()) ? ' checked ' : ''; $oPage->add('
'); - $oPage->add_ready_script( - <<<'JS' -$("#use-symbolic-links").on("click", function() { - var $this = $(this), - bUseSymbolicLinks = $this.prop("checked"); - var sAuthent = $('#authent_token').val(); - var oAjaxParams = { operation: 'toggle_use_symbolic_links', bUseSymbolicLinks: bUseSymbolicLinks, authent: sAuthent}; - $.post(GetAbsoluteUrlAppRoot()+'setup/ajax.dataloader.php', oAjaxParams); -}); -JS - ); } } diff --git a/setup/wizardsteps/WizStepUpgradeMiscParams.php b/setup/wizardsteps/WizStepUpgradeMiscParams.php index c14d51fb7..e88222e18 100644 --- a/setup/wizardsteps/WizStepUpgradeMiscParams.php +++ b/setup/wizardsteps/WizStepUpgradeMiscParams.php @@ -17,6 +17,7 @@ * * You should have received a copy of the GNU Affero General Public License */ + use Combodo\iTop\Application\WebPage\WebPage; /** @@ -38,6 +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('force-uninstall', false); return new WizardState(WizStepModulesChoice::class, 'start_upgrade'); }