Skip to content

Commit 00c4cd1

Browse files
committed
feat: add option to force install modules
1 parent 6821705 commit 00c4cd1

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

src/Classes/Controllers/IndexController.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,28 @@ public function invokeInstall()
392392
return $this->redirect('/');
393393
}
394394

395+
$force = $queryParams['force'] ?? '';
396+
$force = $force === 'true' ? true : false;
397+
398+
395399
try {
396-
$this->moduleInstaller->installWithDependencies($module);
400+
if ($force) {
401+
$this->moduleInstaller->install($module, true);
402+
} else {
403+
$this->moduleInstaller->installWithDependencies($module);
404+
}
397405
} catch (DependencyException $e) {
406+
$foreInstallUrl = "?action=install"
407+
. "&archiveName={$module->getArchiveName()}"
408+
. "&version={$module->getVersion()}"
409+
. "&ref=moduleInfo"
410+
. "&force=true";
411+
398412
Notification::pushFlashMessage([
399-
'text' => $e->getMessage(),
413+
'text' => $e->getMessage()
414+
. '<br><br>Click here to <a href="' . $foreInstallUrl . '">'
415+
. 'force install ' . $module->getArchiveName() . ':' . $module->getVersion()
416+
. ' without dependencies.</a>',
400417
'type' => 'error'
401418
]);
402419
} catch (RuntimeException $e) {

0 commit comments

Comments
 (0)