-
Notifications
You must be signed in to change notification settings - Fork 278
N°8864 list extensions installation in setup recap #790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/uninstallation
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1397,9 +1397,50 @@ public function ProcessParams($bMoveForward = true) | |
| if (class_exists('CreateITILProfilesInstaller')) { | ||
| $this->oWizard->SetParameter('old_addon', true); | ||
| } | ||
|
|
||
| $aExtensionsAdded = []; | ||
| $aExtensionsRemoved = []; | ||
| $aExtensionsNotUninstallable = []; | ||
| foreach ($this->oExtensionsMap->GetAllExtensionsWithPreviouslyInstalled() as $oExtension) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you extract all changes in a separate function? and cover it with tests? |
||
| /* @var \iTopExtension $oExtension */ | ||
| $bSelected = in_array($oExtension->sCode, $aExtensions); | ||
| if ($oExtension->bInstalled && !$bSelected) { | ||
| $aExtensionsRemoved[$oExtension->sCode] = $oExtension->sLabel; | ||
| } elseif (!$oExtension->bInstalled && $bSelected) { | ||
| $aExtensionsAdded[$oExtension->sCode] = $oExtension->sLabel; | ||
| } | ||
| if (!$oExtension->CanBeUninstalled()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to add uninstallable extensions when added. please move this 3 lines above. |
||
| $aExtensionsNotUninstallable[$oExtension->sCode] = true; | ||
| } | ||
| } | ||
|
|
||
| $sExtensionsAdded = '<ul><li>No extension added.</li></ul>'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this variable is initialized with a useless value when below array count >0. |
||
| if (count($aExtensionsAdded) > 0) { | ||
| $sExtensionsAdded = '<ul>'; | ||
| foreach ($aExtensionsAdded as $sExtensionCode) { | ||
| $sExtensionsAdded .= '<li>'.$sExtensionCode.'</li>'; | ||
| } | ||
| $sExtensionsAdded .= '</ul>'; | ||
| } | ||
|
|
||
| $sExtensionsRemoved = '<ul><li>No extension removed.</li></ul>'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same remark. this variable is initialized with a useless value when below array count >0. |
||
| if (count($aExtensionsRemoved) > 0) { | ||
| $sExtensionsRemoved = '<ul>'; | ||
| foreach ($aExtensionsRemoved as $sCode => $sExtensionCode) { | ||
| $sForcedUninstall = ''; | ||
| if (isset($aExtensionsNotUninstallable[$sCode])) { | ||
| $sForcedUninstall = ' (forced uninstallation)'; | ||
| } | ||
| $sExtensionsRemoved .= '<li>'.$sExtensionCode.$sForcedUninstall.'</li>'; | ||
| } | ||
| $sExtensionsRemoved .= '</ul>'; | ||
| } | ||
|
|
||
| $this->oWizard->SetParameter('selected_modules', json_encode(array_keys($aModules))); | ||
| $this->oWizard->SetParameter('selected_extensions', json_encode($aExtensions)); | ||
| $this->oWizard->SetParameter('display_choices', $sDisplayChoices); | ||
| $this->oWizard->SetParameter('extensions_added', $sExtensionsAdded); | ||
| $this->oWizard->SetParameter('extensions_removed', $sExtensionsRemoved); | ||
| return ['class' => 'WizStepSummary', 'state' => '']; | ||
| } | ||
|
|
||
|
|
@@ -2217,6 +2258,14 @@ public function Display(WebPage $oPage) | |
|
|
||
| $oPage->add('<fieldset id="summary"><legend>Installation Parameters</legend>'); | ||
| $oPage->add('<div id="params_summary">'); | ||
|
|
||
| $oPage->add('<div class="closed"><span class="title ibo-setup-summary-title">Extensions to be installed</span>'); | ||
| $oPage->add($this->oWizard->GetParameter('extensions_added')); | ||
| $oPage->add('</div>'); | ||
| $oPage->add('<div class="closed"><span class="title ibo-setup-summary-title">Extensions to be uninstalled</span>'); | ||
| $oPage->add($this->oWizard->GetParameter('extensions_removed')); | ||
| $oPage->add('</div>'); | ||
|
|
||
| $oPage->add('<div class="closed"><span class="title ibo-setup-summary-title">Database Parameters</span><ul>'); | ||
| $oPage->add('<li>Server Name: '.$aInstallParams['database']['server'].'</li>'); | ||
| $oPage->add('<li>DB User Name: '.$aInstallParams['database']['user'].'</li>'); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the 2 arrays could contain html lines instead of extension codes. afterwhile you could use implode. code would be simpler.