commit13
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
require dirname(__DIR__).'/vendor/autoload.php';
|
||||
|
||||
try {
|
||||
if (count($argv) !== 3 || ! is_file($argv[1].'/scripts/sgf.ps1')) {
|
||||
throw new RuntimeException('Uso: transfer-purchasing.php <instalação-SGF> <canal-de-versões>.');
|
||||
}
|
||||
$host = realpath($argv[1]);
|
||||
$publish = new Process([PHP_BINARY, 'scripts/publish-purchasing.php', $argv[2]], dirname(__DIR__), timeout: 180);
|
||||
$publish->mustRun();
|
||||
$release = json_decode($publish->getOutput(), true, 64, JSON_THROW_ON_ERROR);
|
||||
$archive = realpath($argv[2]).'/'.$release['archive'];
|
||||
$run = function (string $action) use ($host, $archive, $release): array {
|
||||
// Respect the host's pinned PHP/dependencies; no PATH or dependency replacement.
|
||||
$process = new Process(['powershell.exe', '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', $host.'/scripts/sgf.ps1', 'php', 'scripts/purchasing-release.php', $action, $host, $archive, $release['manifest_sha256']], $host, timeout: 60);
|
||||
$process->mustRun();
|
||||
|
||||
return json_decode($process->getOutput(), true, 64, JSON_THROW_ON_ERROR);
|
||||
};
|
||||
$plan = $run('check');
|
||||
$installed = $plan['available'] ? $run('install') : ['changed' => false, 'version' => $plan['installed_version']];
|
||||
echo json_encode(['release' => $release, 'plan' => $plan, 'installation' => $installed, 'database_changes' => false, 'permissions_changed' => false], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)."\n";
|
||||
} catch (Throwable $error) {
|
||||
fwrite(STDERR, $error->getMessage()."\n");
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user