2022-08-03 21:50:48 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function resetEnvironmentToBackup(string $name = 'main', bool $forceprint = false) {
|
|
|
|
$output = [];
|
|
|
|
$ret = -1;
|
|
|
|
exec("./.github/actions/run-tests/reset-from-container.sh $name 2>&1", $output, $ret);
|
|
|
|
if ($ret !== 0 || $forceprint) {
|
|
|
|
echo "\nStandard output:\n";
|
|
|
|
print_r($output);
|
|
|
|
echo "Return value: $ret\n";
|
|
|
|
if ($ret !== 0) {
|
2024-08-26 20:04:35 +03:00
|
|
|
throw new Exception('Could not reset environment');
|
2022-08-03 21:50:48 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function runOCCCommand(array $args, bool $forceprint = false) {
|
|
|
|
$output = [];
|
|
|
|
$ret = -1;
|
|
|
|
$params = join(' ', array_map(function ($x) {
|
|
|
|
return escapeshellarg($x);
|
|
|
|
}, $args));
|
|
|
|
|
|
|
|
$cmd = "./.github/actions/run-tests/run-occ.sh $params 2>&1";
|
|
|
|
|
|
|
|
exec($cmd, $output, $ret);
|
|
|
|
if ($ret !== 0 || $forceprint) {
|
|
|
|
echo "\nStandard output:\n";
|
|
|
|
print_r($output);
|
|
|
|
echo "Return value: $ret\n";
|
|
|
|
if ($ret !== 0) {
|
2024-08-26 20:04:35 +03:00
|
|
|
throw new Exception('Could not run OCC command');
|
2022-08-03 21:50:48 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|