Files
crm.clientright.ru/crm_extensions/file_storage/check_project_390657.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

111 lines
4.1 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 Project 390657 for broken links
*/
$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 "=== Анализ проекта 390657 ===\n\n";
// 1. Ищем файлы, связанные с проектом 390657
echo "1. Поиск файлов проекта 390657...\n";
$query = "SELECT n.notesid, n.title, n.filename, n.filetype, n.filesize, n.s3_key, n.s3_bucket
FROM vtiger_notes n
LEFT JOIN vtiger_senotesrel snr ON n.notesid = snr.notesid
LEFT JOIN vtiger_crmentity ce ON snr.crmid = ce.crmid
WHERE ce.deleted = 0
AND (n.filename LIKE '%390657%' OR ce.crmid = 390657)
AND n.filelocationtype = 'E'
ORDER BY n.notesid DESC";
$result = $mysqli->query($query);
if ($result && $result->num_rows > 0) {
echo "Найдено файлов: " . $result->num_rows . "\n\n";
$broken_files = [];
$total_files = 0;
while ($row = $result->fetch_assoc()) {
$total_files++;
echo "Файл ID: " . $row['notesid'] . "\n";
echo "Название: " . $row['title'] . "\n";
echo "URL: " . substr($row['filename'], 0, 100) . "...\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";
// Проверяем доступность файла
if (!empty($row['filename']) && strpos($row['filename'], 'https://s3.twcstorage.ru') !== false) {
$headers = @get_headers($row['filename'], 1);
if ($headers && strpos($headers[0], '200') !== false) {
echo "✅ Файл доступен\n";
} else {
echo "❌ Файл недоступен (битая ссылка)\n";
$broken_files[] = $row;
}
} else {
echo "⚠️ Нестандартный URL\n";
}
echo "---\n";
}
echo "\n=== СТАТИСТИКА ===\n";
echo "Всего файлов: $total_files\n";
echo "Битых ссылок: " . count($broken_files) . "\n";
if (!empty($broken_files)) {
echo "\n=== БИТЫЕ ФАЙЛЫ ===\n";
foreach ($broken_files as $file) {
echo "ID: " . $file['notesid'] . " - " . $file['title'] . "\n";
echo "URL: " . $file['filename'] . "\n";
echo "S3 Key: " . ($file['s3_key'] ?: 'NULL') . "\n\n";
}
}
} else {
echo "Файлы проекта 390657 не найдены.\n";
}
// 2. Ищем все файлы с потенциально битыми ссылками
echo "\n2. Поиск всех файлов с битыми S3 ссылками...\n";
$broken_query = "SELECT notesid, title, filename, s3_key, s3_bucket
FROM vtiger_notes
WHERE filelocationtype = 'E'
AND filename LIKE '%s3.twcstorage.ru%'
AND filename LIKE '%D0%B'
ORDER BY notesid DESC
LIMIT 10";
$broken_result = $mysqli->query($broken_query);
if ($broken_result && $broken_result->num_rows > 0) {
echo "Найдено файлов с обрезанными ссылками: " . $broken_result->num_rows . "\n\n";
while ($row = $broken_result->fetch_assoc()) {
echo "ID: " . $row['notesid'] . "\n";
echo "Название: " . $row['title'] . "\n";
echo "Обрезанная URL: " . substr($row['filename'], 0, 80) . "...\n";
echo "S3 Key: " . ($row['s3_key'] ?: 'NULL') . "\n";
echo "---\n";
}
} else {
echo "Файлов с обрезанными ссылками не найдено.\n";
}
$mysqli->close();
echo "\n=== Проверка завершена ===\n";
?>