From 416403b6cead7b4912e8b9c3d544beb7cd6b3686 Mon Sep 17 00:00:00 2001 From: F4ilji Date: Sun, 5 Jul 2026 13:33:13 +0500 Subject: [PATCH] debug(vikon): add detailed logging for ZIP size and FM sync stats --- .../Actions/UpdateCoreAction.php | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/app/Containers/VikonIntegration/Actions/UpdateCoreAction.php b/app/Containers/VikonIntegration/Actions/UpdateCoreAction.php index 10648a2..53b502c 100644 --- a/app/Containers/VikonIntegration/Actions/UpdateCoreAction.php +++ b/app/Containers/VikonIntegration/Actions/UpdateCoreAction.php @@ -52,8 +52,14 @@ class UpdateCoreAction $zipFile ); + Log::info('Vikon: ZIP downloaded', ['size' => filesize($zipFile), 'module' => $moduleId]); + $this->extractZip($zipFile, $tempPath); + // Log what was extracted + $extracted = array_map(fn($f) => basename($f), File::allFiles($tempPath)); + Log::info('Vikon: extracted files', ['count' => count($extracted), 'sample' => array_slice($extracted, 0, 10)]); + $blocked = $this->fs->validateFileTypes($tempPath); if (!empty($blocked)) { throw new \RuntimeException('Запрещённые файлы: ' . implode(', ', $blocked)); @@ -74,7 +80,7 @@ class UpdateCoreAction File::makeDirectory($filesDir, 0755, true, true); $dirIds = $this->getUsedDirNames($moduleId, $accessToken); - Log::info('Vikon FM: dir identifiers', ['count' => count($dirIds)]); + Log::info('Vikon FM: dir identifiers', ['count' => count($dirIds), 'dirs' => $dirIds]); $synced = 0; @@ -107,6 +113,10 @@ class UpdateCoreAction } } + $serverCount = count($files); + $localCount = count($existingFiles); + $toDownload = 0; + $synced = 0; foreach ($files as $file) { $name = $file['n'] ?? null; @@ -117,6 +127,7 @@ class UpdateCoreAction continue; } + $toDownload++; try { $content = $this->http->downloadWithToken( "sync/downloadFileBinaryForSync?identity={$identity}&moduleId={$moduleId}", @@ -129,6 +140,14 @@ class UpdateCoreAction Log::warning('Vikon FM: root download failed', ['identity' => $identity, 'error' => $e->getMessage()]); } } + + Log::info('Vikon FM: root dir stats', [ + 'server' => $serverCount, + 'local' => $localCount, + 'to_download' => $toDownload, + 'synced' => $synced, + ]); + return $synced; }