Skip to content

Commit f516053

Browse files
committed
N°9088 Allow extension uninstallation from production-modules folder
1 parent f062972 commit f516053

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

setup/extensionsmap.class.inc.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,14 @@ public function GetAllExtensionsWithPreviouslyInstalled(): array
375375
* @return array<\iTopExtension>>
376376
*/
377377

378-
public function GetAllExtensionsToDisplayInSetup(bool $bKeepMissingDependencyExtensions = false): array
378+
public function GetAllExtensionsToDisplayInSetup(bool $bKeepMissingDependencyExtensions = false, bool $bMandatoryRemoteExtension = true): array
379379
{
380380
$aRes = [];
381381
foreach ($this->GetAllExtensionsWithPreviouslyInstalled() as $oExtension) {
382382
/** @var \iTopExtension $oExtension */
383-
if (($oExtension->sSource !== iTopExtension::SOURCE_WIZARD) && ($oExtension->bVisible)) {
384-
if ($bKeepMissingDependencyExtensions || (count($oExtension->aMissingDependencies) == 0)) {
385-
if (!$oExtension->bMandatory) {
383+
if ($oExtension->sSource !== iTopExtension::SOURCE_WIZARD && $oExtension->bVisible) {
384+
if ($bKeepMissingDependencyExtensions || count($oExtension->aMissingDependencies) == 0) {
385+
if (!$oExtension->bMandatory && $bMandatoryRemoteExtension) {
386386
$oExtension->bMandatory = ($oExtension->sSource === iTopExtension::SOURCE_REMOTE);
387387
}
388388
$aRes[$oExtension->sCode] = $oExtension;
@@ -393,10 +393,10 @@ public function GetAllExtensionsToDisplayInSetup(bool $bKeepMissingDependencyExt
393393
return $aRes;
394394
}
395395

396-
public function GetAllExtensionsOptionInfo(): array
396+
public function GetAllExtensionsOptionInfo(bool $bMandatoryRemoteExtension = true): array
397397
{
398398
$aRes = [];
399-
foreach ($this->GetAllExtensionsToDisplayInSetup() as $sCode => $oExtension) {
399+
foreach ($this->GetAllExtensionsToDisplayInSetup(false, $bMandatoryRemoteExtension) as $sCode => $oExtension) {
400400
$aRes[] = [
401401
'extension_code' => $oExtension->sCode,
402402
'title' => $oExtension->sLabel,

setup/wizardsteps/WizStepModulesChoice.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ protected function GetStepIndex()
626626
protected function GetStepInfo($idx = null)
627627
{
628628
$index = $idx ?? $this->GetStepIndex();
629-
629+
$bMandatoryRemoteExtension = !$this->oWizard->GetParameter('force-uninstall', false);
630630
if (is_null($this->aSteps)) {
631631
$this->oWizard->SetParameter('additional_extensions_modules', json_encode([])); // Default value, no additional extensions
632632

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

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

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

656656
// 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.
657657
$this->aSteps = [

0 commit comments

Comments
 (0)