Files
crm.clientright.ru/crm_extensions/file_storage/api/check_file.php
Fedor 9245768987 🚀 CRM Files Migration & Real-time Features
 Features:
- Migrated ALL files to new S3 structure (Projects, Contacts, Accounts, HelpDesk, Invoice, etc.)
- Added Nextcloud folder buttons to ALL modules
- Fixed Nextcloud editor integration
- WebSocket server for real-time updates
- Redis Pub/Sub integration
- File path manager for organized storage
- Redis caching for performance (Functions.php)

📁 New Structure:
Documents/Project/ProjectName_ID/file_docID.ext
Documents/Contacts/FirstName_LastName_ID/file_docID.ext
Documents/Accounts/AccountName_ID/file_docID.ext

🔧 Technical:
- FilePathManager for standardized paths
- S3StorageService integration
- WebSocket server (Node.js + Docker)
- Redis cache for getBasicModuleInfo()
- Predis library for Redis connectivity

📝 Scripts:
- Migration scripts for all modules
- Test pages for WebSocket/SSE/Polling
- Documentation (MIGRATION_*.md, REDIS_*.md)

🎯 Result: 15,000+ files migrated successfully!
2025-10-24 19:59:28 +03:00

75 lines
2.1 KiB
PHP

<?php
/**
* Вспомогательный API для проверки файлов в тесте SSE
*/
header('Content-Type: text/plain');
header('Access-Control-Allow-Origin: *');
$file = $_GET['file'] ?? '';
if (empty($file)) {
echo '❌ Файл не указан';
exit;
}
// Проверяем безопасность пути
if (strpos($file, '..') !== false || strpos($file, '/') === 0) {
echo '❌ Небезопасный путь';
exit;
}
// Разрешенные файлы для проверки
$allowedFiles = [
'/tmp/crm_sse_events.json',
'/var/log/crm_nextcloud_webhook.log'
];
if (!in_array($file, $allowedFiles)) {
echo '❌ Файл не разрешен для проверки';
exit;
}
if (file_exists($file)) {
$size = filesize($file);
$modified = date('Y-m-d H:i:s', filemtime($file));
$readable = is_readable($file) ? '✅' : '❌';
$writable = is_writable($file) ? '✅' : '❌';
echo "✅ Файл существует\n";
echo " Размер: " . number_format($size) . " байт\n";
echo " Изменен: $modified\n";
echo " Чтение: $readable\n";
echo " Запись: $writable\n";
// Показываем последние строки для логов
if (strpos($file, '.log') !== false && $size > 0) {
echo "\n📝 Последние строки:\n";
$lines = file($file);
$lastLines = array_slice($lines, -5);
foreach ($lastLines as $line) {
echo " " . trim($line) . "\n";
}
}
// Показываем содержимое для JSON файлов
if (strpos($file, '.json') !== false && $size > 0) {
echo "\n📄 Содержимое:\n";
$content = file_get_contents($file);
$json = json_decode($content, true);
if ($json) {
echo " " . json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n";
} else {
echo " " . $content . "\n";
}
}
} else {
echo '❌ Файл не существует';
}
?>