more bug fix for check end testing
This commit is contained in:
parent
84a758dd34
commit
819559a3b9
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
hesabixArchive/
|
hesabixArchive/
|
||||||
hesabixBackup/
|
hesabixBackup/
|
||||||
|
backup/
|
||||||
.idea/
|
.idea/
|
||||||
|
|
|
@ -35,7 +35,12 @@ final class UpdateCoreController extends AbstractController
|
||||||
'completedSteps' => [],
|
'completedSteps' => [],
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$process = new Process(['php', 'bin/console', 'hesabix:update', $stateFile], $projectDir);
|
$env = array_merge($_SERVER, [
|
||||||
|
'HOME' => '/var/www',
|
||||||
|
'COMPOSER_HOME' => '/var/www/.composer',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$process = new Process(['php', 'bin/console', 'hesabix:update', $stateFile], $projectDir, $env);
|
||||||
$process->setTimeout(3600);
|
$process->setTimeout(3600);
|
||||||
$process->run(function ($type, $buffer) use ($stateFile) {
|
$process->run(function ($type, $buffer) use ($stateFile) {
|
||||||
$state = json_decode(file_get_contents($stateFile), true) ?? ['uuid' => uniqid(), 'log' => ''];
|
$state = json_decode(file_get_contents($stateFile), true) ?? ['uuid' => uniqid(), 'log' => ''];
|
||||||
|
@ -104,6 +109,15 @@ final class UpdateCoreController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$isRunning) {
|
if (!$isRunning) {
|
||||||
|
// عملیات موفق بوده، فایلهای update_state_*.json رو حذف کن
|
||||||
|
$backupDir = $this->getParameter('kernel.project_dir') . '/../backup';
|
||||||
|
$stateFiles = glob($backupDir . '/update_state_*.json');
|
||||||
|
foreach ($stateFiles as $file) {
|
||||||
|
if (is_file($file)) {
|
||||||
|
unlink($file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new JsonResponse([
|
return new JsonResponse([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => 'Update completed successfully',
|
'message' => 'Update completed successfully',
|
||||||
|
@ -141,13 +155,11 @@ final class UpdateCoreController extends AbstractController
|
||||||
#[Route('/api/admin/updatecore/system-info', name: 'api_admin_updatecore_system_info', methods: ['GET'])]
|
#[Route('/api/admin/updatecore/system-info', name: 'api_admin_updatecore_system_info', methods: ['GET'])]
|
||||||
public function api_admin_updatecore_system_info(): JsonResponse
|
public function api_admin_updatecore_system_info(): JsonResponse
|
||||||
{
|
{
|
||||||
// اطلاعات سیستمعامل
|
|
||||||
$osName = php_uname('s');
|
$osName = php_uname('s');
|
||||||
$osRelease = php_uname('r');
|
$osRelease = php_uname('r');
|
||||||
$osVersion = php_uname('v');
|
$osVersion = php_uname('v');
|
||||||
$osMachine = php_uname('m');
|
$osMachine = php_uname('m');
|
||||||
|
|
||||||
// اطلاعات پردازنده
|
|
||||||
$cpuInfo = 'Unknown';
|
$cpuInfo = 'Unknown';
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||||
$cpuInfo = shell_exec('wmic cpu get caption') ?? 'Unknown';
|
$cpuInfo = shell_exec('wmic cpu get caption') ?? 'Unknown';
|
||||||
|
@ -156,7 +168,6 @@ final class UpdateCoreController extends AbstractController
|
||||||
$cpuInfo = str_replace('model name : ', '', trim($cpuInfo));
|
$cpuInfo = str_replace('model name : ', '', trim($cpuInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
// اطلاعات توزیع لینوکس
|
|
||||||
$distroName = 'Unknown';
|
$distroName = 'Unknown';
|
||||||
$distroVersion = 'Unknown';
|
$distroVersion = 'Unknown';
|
||||||
if (strtoupper(PHP_OS) === 'LINUX') {
|
if (strtoupper(PHP_OS) === 'LINUX') {
|
||||||
|
@ -169,17 +180,14 @@ final class UpdateCoreController extends AbstractController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// اطلاعات وبسرور
|
|
||||||
$webServer = $_SERVER['SERVER_SOFTWARE'] ?? 'Unknown';
|
$webServer = $_SERVER['SERVER_SOFTWARE'] ?? 'Unknown';
|
||||||
|
|
||||||
// اطلاعات بانک اطلاعاتی
|
|
||||||
$dbVersion = 'Unknown';
|
$dbVersion = 'Unknown';
|
||||||
$dbName = 'Unknown';
|
$dbName = 'Unknown';
|
||||||
try {
|
try {
|
||||||
$dbParams = $this->connection->getParams();
|
$dbParams = $this->connection->getParams();
|
||||||
$dbName = $dbParams['driver'] ?? 'Unknown';
|
$dbName = $dbParams['driver'] ?? 'Unknown';
|
||||||
|
|
||||||
// گرفتن نسخه بانک اطلاعاتی با کوئری SQL
|
|
||||||
if (str_contains($dbName, 'mysql')) {
|
if (str_contains($dbName, 'mysql')) {
|
||||||
$dbVersion = $this->connection->fetchOne('SELECT VERSION()');
|
$dbVersion = $this->connection->fetchOne('SELECT VERSION()');
|
||||||
} elseif (str_contains($dbName, 'pgsql')) {
|
} elseif (str_contains($dbName, 'pgsql')) {
|
||||||
|
|
Loading…
Reference in a new issue