fix(update): install composer deps during package apply

This commit is contained in:
michele 2026-03-15 19:18:25 +00:00
parent 07c440fad4
commit c505104244
2 changed files with 651 additions and 253 deletions

View File

@ -4,6 +4,7 @@
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Process;
use ZipArchive;
class NetgesconDistributionPullCommand extends Command
@ -181,6 +182,22 @@ public function handle(): int
File::copy($envBackup, base_path('.env'));
}
if ($this->packageContainsComposerFiles($extractDir)) {
$this->info('Aggiornamento dipendenze PHP...');
$this->writeProgress(86, 'Aggiornamento dipendenze PHP', 'running');
$composer = Process::path(base_path())
->timeout(1800)
->run(['composer', 'install', '--no-dev', '--optimize-autoloader']);
if (! $composer->successful()) {
$this->error('Composer install fallito durante update.');
$this->line(trim((string) ($composer->errorOutput() !== '' ? $composer->errorOutput() : $composer->output())));
$this->writeProgress(100, 'Composer install fallito durante update', 'failed', 1);
return self::FAILURE;
}
}
$this->call('optimize:clear');
$this->writeProgress(90, 'Pulizia cache applicazione', 'running');
@ -236,6 +253,11 @@ private function syncDir(string $from, string $to): void
}
}
private function packageContainsComposerFiles(string $extractDir): bool
{
return File::exists($extractDir . '/composer.json') || File::exists($extractDir . '/composer.lock');
}
/**
* @return array<int, string>
*/

882
composer.lock generated

File diff suppressed because it is too large Load Diff