This commit is contained in:
Bozhidar 2024-04-26 22:41:48 +03:00
parent d8d95fe007
commit 3ba3f1e904
4 changed files with 28 additions and 10 deletions

View file

@ -6,6 +6,7 @@ use App\ModulePostInstall;
class PostInstall extends ModulePostInstall
{
public $supportLog = true;
public function run()
{
$installDockerShellFile = base_path('Modules/Docker/shell-scripts/install-docker.sh');

View file

@ -7,6 +7,7 @@ use Modules\Microweber\Filament\Clusters\Microweber\Pages\Version;
class PostInstall extends ModulePostInstall
{
public $supportLog = false;
public function run()
{
$version = new Version();

View file

@ -100,21 +100,31 @@ class Modules extends Page
try {
$postInstall = app()->make('Modules\\' . $module . '\\PostInstall');
if (method_exists($postInstall, 'run')) {
$postInstall->setLogFile($this->installLogFilePath);
if ($postInstall->isSupportLog()) {
$postInstall->setLogFile($this->installLogFilePath);
}
$postInstall->run();
$this->dispatch('open-modal', id: 'install-module-modal', props: ['module' => $module]);
if ($postInstall->isSupportLog()) {
$this->dispatch('open-modal', id: 'install-module-modal', props: ['module' => $module]);
return;
}
}
} catch(\Exception $e) {
$newModule = new Module();
$newModule->name = $module;
$newModule->namespace = 'Modules\\' . $module;
$newModule->installed = 1;
$newModule->save();
$this->installLogPulling = false;
// dd($e->getMessage());
}
$newModule = new Module();
$newModule->name = $module;
$newModule->namespace = 'Modules\\' . $module;
$newModule->installed = 1;
$newModule->save();
$this->installLogPulling = false;
}
}

View file

@ -4,6 +4,12 @@ namespace App;
abstract class ModulePostInstall
{
public $supportLog = false;
public function isSupportLog()
{
return $this->supportLog;
}
public function setLogFile($logFile)
{
$this->logFile = $logFile;