Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions setup/extensionsmap.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,14 @@ public function GetAllExtensionsWithPreviouslyInstalled(): array
* @return array<\iTopExtension>>
*/

public function GetAllExtensionsToDisplayInSetup(bool $bKeepMissingDependencyExtensions = false): array
public function GetAllExtensionsToDisplayInSetup(bool $bKeepMissingDependencyExtensions = false, bool $bMandatoryRemoteExtension = true): array
{
$aRes = [];
foreach ($this->GetAllExtensionsWithPreviouslyInstalled() as $oExtension) {
/** @var \iTopExtension $oExtension */
if (($oExtension->sSource !== iTopExtension::SOURCE_WIZARD) && ($oExtension->bVisible)) {
if ($bKeepMissingDependencyExtensions || (count($oExtension->aMissingDependencies) == 0)) {
if (!$oExtension->bMandatory) {
if ($oExtension->sSource !== iTopExtension::SOURCE_WIZARD && $oExtension->bVisible) {
if ($bKeepMissingDependencyExtensions || count($oExtension->aMissingDependencies) == 0) {
if (!$oExtension->bMandatory && $bMandatoryRemoteExtension) {
$oExtension->bMandatory = ($oExtension->sSource === iTopExtension::SOURCE_REMOTE);
}
$aRes[$oExtension->sCode] = $oExtension;
Expand All @@ -393,10 +393,10 @@ public function GetAllExtensionsToDisplayInSetup(bool $bKeepMissingDependencyExt
return $aRes;
}

public function GetAllExtensionsOptionInfo(): array
public function GetAllExtensionsOptionInfo(bool $bMandatoryRemoteExtension = true): array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 methods got a new parameter. is it covered by new usecases?

{
$aRes = [];
foreach ($this->GetAllExtensionsToDisplayInSetup() as $sCode => $oExtension) {
foreach ($this->GetAllExtensionsToDisplayInSetup(false, $bMandatoryRemoteExtension) as $sCode => $oExtension) {
$aRes[] = [
'extension_code' => $oExtension->sCode,
'title' => $oExtension->sLabel,
Expand Down
6 changes: 3 additions & 3 deletions setup/wizardsteps/WizStepModulesChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ protected function GetStepIndex()
protected function GetStepInfo($idx = null)
{
$index = $idx ?? $this->GetStepIndex();

$bMandatoryRemoteExtension = !$this->oWizard->GetParameter('force-uninstall', false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$bMandatoryRemoteExtension purpose is not so clear. please se if the naming could help

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name changed to $bRemoteExtensionsShouldBeMandatory

if (is_null($this->aSteps)) {
$this->oWizard->SetParameter('additional_extensions_modules', json_encode([])); // Default value, no additional extensions

Expand All @@ -637,7 +637,7 @@ protected function GetStepInfo($idx = null)

if ($index + 1 >= count($this->aSteps)) {
//make sure we also cache next step as well
$aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo();
$aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo($bMandatoryRemoteExtension);

// Display this step of the wizard only if there is something to display
if (count($aOptions) > 0) {
Expand All @@ -651,7 +651,7 @@ protected function GetStepInfo($idx = null)
}
}
} else {
$aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo();
$aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo($bMandatoryRemoteExtension);

// No wizard configuration provided, build a standard one with just one big list. All items are mandatory, only works when there are no conflicted modules.
$this->aSteps = [
Expand Down