Files
crm.clientright.ru/crm_extensions/file_storage/check_file_394503.php
Fedor ac7467f0b4 Major CRM updates: AI Assistant, Court Status API, S3 integration improvements, and extensive file storage system
- Added comprehensive AI Assistant system (aiassist/ directory):
  * Vector search and embedding capabilities
  * Typebot proxy integration
  * Elastic search functionality
  * Message classification and chat history
  * MCP proxy for external integrations

- Implemented Court Status API (GetCourtStatus.php):
  * Real-time court document status checking
  * Integration with external court systems
  * Comprehensive error handling and logging

- Enhanced S3 integration:
  * Improved file backup system with metadata
  * Batch processing capabilities
  * Enhanced error logging and recovery
  * Copy operations with URL fixing

- Added Telegram contact creation API
- Improved error logging across all modules
- Enhanced callback system for AI responses
- Extensive backup file storage with timestamps
- Updated documentation and README files

- File storage improvements:
  * Thousands of backup files with proper metadata
  * Fix operations for broken file references
  * Project-specific backup and recovery systems
  * Comprehensive file integrity checking

Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
2025-10-16 11:17:21 +03:00

103 lines
4.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Check specific file 394503
*/
$ROOT = '/var/www/fastuser/data/www/crm.clientright.ru/';
require_once $ROOT . 'config.inc.php';
// Database connection
$mysqli = new mysqli($dbconfig['db_server'], $dbconfig['db_username'], $dbconfig['db_password'], $dbconfig['db_name']);
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
$mysqli->set_charset("utf8");
echo "=== Проверка файла 394503 ===\n\n";
// Получаем данные файла
$query = "SELECT notesid, title, filename, filetype, filesize, s3_key, s3_bucket, s3_etag, nc_path
FROM vtiger_notes
WHERE notesid = 394503";
$result = $mysqli->query($query);
if ($result && $result->num_rows > 0) {
$row = $result->fetch_assoc();
echo "✅ Файл найден:\n";
echo "ID: " . $row['notesid'] . "\n";
echo "Название: " . $row['title'] . "\n";
echo "URL: " . $row['filename'] . "\n";
echo "Тип: " . $row['filetype'] . "\n";
echo "Размер: " . $row['filesize'] . " байт\n";
echo "S3 Key: " . ($row['s3_key'] ?: 'NULL') . "\n";
echo "S3 Bucket: " . ($row['s3_bucket'] ?: 'NULL') . "\n";
echo "S3 ETag: " . ($row['s3_etag'] ?: 'NULL') . "\n";
echo "NC Path: " . ($row['nc_path'] ?: 'NULL') . "\n\n";
// Проверяем доступность файла
if (!empty($row['filename']) && strpos($row['filename'], 'https://s3.twcstorage.ru') !== false) {
echo "Проверка доступности файла...\n";
$headers = @get_headers($row['filename'], 1);
if ($headers && strpos($headers[0], '200') !== false) {
echo "✅ Файл доступен (HTTP 200)\n";
} elseif ($headers && strpos($headers[0], '403') !== false) {
echo "❌ Файл запрещен (HTTP 403) - проблема с правами доступа\n";
} elseif ($headers && strpos($headers[0], '404') !== false) {
echo "❌ Файл не найден (HTTP 404) - файл отсутствует в S3\n";
} else {
echo "❓ Неизвестная ошибка: " . ($headers[0] ?? 'Нет ответа') . "\n";
}
// Пробуем разные варианты URL для исправления
if ($headers && strpos($headers[0], '200') === false && !empty($row['s3_key']) && !empty($row['s3_bucket'])) {
echo "\nПопытка исправления URL...\n";
// Вариант 1: Правильная кодировка S3 ключа
$encoded_key = implode('/', array_map('rawurlencode', explode('/', $row['s3_key'])));
$correct_url = "https://s3.twcstorage.ru/" . $row['s3_bucket'] . "/" . $encoded_key;
echo "Правильный URL: " . $correct_url . "\n";
$correct_headers = @get_headers($correct_url, 1);
if ($correct_headers && strpos($correct_headers[0], '200') !== false) {
echo "✅ Правильный URL работает!\n";
// Предлагаем исправление
echo "\nХотите исправить URL? (y/n): ";
// В реальном скрипте здесь можно добавить автоматическое исправление
} else {
echo "❌ Правильный URL тоже не работает\n";
}
}
} else {
echo "⚠️ Нестандартный URL или отсутствует URL\n";
}
// Проверяем связанные записи
echo "\nПроверка связанных записей...\n";
$related_query = "SELECT crmid, label FROM vtiger_crmentity ce
INNER JOIN vtiger_senotesrel snr ON ce.crmid = snr.crmid
WHERE snr.notesid = 394503";
$related_result = $mysqli->query($related_query);
if ($related_result && $related_result->num_rows > 0) {
echo "Связанные записи:\n";
while ($rel_row = $related_result->fetch_assoc()) {
echo "- ID: " . $rel_row['crmid'] . " - " . $rel_row['label'] . "\n";
}
} else {
echo "Связанные записи не найдены\n";
}
} else {
echo "❌ Файл 394503 не найден в базе данных\n";
}
$mysqli->close();
echo "\n=== Проверка завершена ===\n";
?>