✨ 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!
35 lines
703 B
PHP
35 lines
703 B
PHP
<?php
|
||
/**
|
||
* API для polling событий
|
||
*/
|
||
|
||
header('Content-Type: application/json');
|
||
header('Access-Control-Allow-Origin: *');
|
||
|
||
$eventsFile = '/tmp/crm_sse_events.json';
|
||
$events = [];
|
||
|
||
// Читаем с блокировкой
|
||
$fp = @fopen($eventsFile, 'c+');
|
||
if ($fp && flock($fp, LOCK_EX)) {
|
||
$content = stream_get_contents($fp);
|
||
if (!empty($content)) {
|
||
$events = json_decode($content, true) ?: [];
|
||
}
|
||
|
||
// Очищаем файл после чтения
|
||
ftruncate($fp, 0);
|
||
|
||
flock($fp, LOCK_UN);
|
||
fclose($fp);
|
||
} else {
|
||
if ($fp) fclose($fp);
|
||
}
|
||
|
||
echo json_encode([
|
||
'status' => 'success',
|
||
'events' => $events,
|
||
'timestamp' => time()
|
||
]);
|
||
?>
|