feat(cache): implement centralized caching layer for improved performance and reduced API calls
feat(microsoft-integration): enhance inbox and events fetching with caching support feat(auth): include theme and notification settings in user data retrieval feat(profile): improve password visibility toggle functionality feat(planner): optimize event synchronization with Outlook using caching fix(notifications): update mail badge handling for mobile and desktop
This commit is contained in:
+15
-5
@@ -79,14 +79,24 @@ $syncIntervalSeconds = isset($outlookIntegrationSettings['sync_interval_seconds'
|
||||
$weekOutlookEvents = [];
|
||||
$isLiveOutlook = false;
|
||||
|
||||
$forceRefresh = !empty($_GET['refresh']) && $_GET['refresh'] === '1';
|
||||
|
||||
if ($isOutlookConnected) {
|
||||
try {
|
||||
// Haal afspraken op voor het volledige datumbereik van de week
|
||||
$weekOutlookEvents = microsoft_fetch_events_range($userId, $weekStart, $weekEnd);
|
||||
// Haal afspraken op voor het volledige datumbereik van de week (met 60s cache)
|
||||
$weekOutlookEvents = microsoft_fetch_events_range($userId, $weekStart, $weekEnd, $forceRefresh);
|
||||
$isLiveOutlook = true;
|
||||
|
||||
// Synchroniseer / reconcilieer Fociz taken direct met actuele Outlook data
|
||||
microsoft_reconcile_tasks_with_outlook($userId, $weekStart, $weekEnd, $weekOutlookEvents);
|
||||
// Alleen uitvoeren indien events gewijzigd zijn of bij expliciete refresh om overtollige DB load te voorkomen
|
||||
$eventsHash = md5(json_encode($weekOutlookEvents));
|
||||
$lastReconciledHash = $_SESSION["last_reconciled_{$userId}"] ?? '';
|
||||
if ($eventsHash !== $lastReconciledHash || $forceRefresh) {
|
||||
microsoft_reconcile_tasks_with_outlook($userId, $weekStart, $weekEnd, $weekOutlookEvents);
|
||||
if (session_status() === PHP_SESSION_ACTIVE) {
|
||||
$_SESSION["last_reconciled_{$userId}"] = $eventsHash;
|
||||
}
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
error_log("Outlook synchronisatiefout in planner: " . $e->getMessage());
|
||||
$isLiveOutlook = false;
|
||||
@@ -224,7 +234,7 @@ for ($i = 0; $i < 7; $i++) {
|
||||
$jiraIssues = [];
|
||||
$isJiraLive = false;
|
||||
try {
|
||||
$jiraData = jira_get_user_issues($userId);
|
||||
$jiraData = jira_get_user_issues($userId, $forceRefresh);
|
||||
$jiraIssues = $jiraData['issues'] ?? [];
|
||||
$isJiraLive = !empty($jiraData['success']) && empty($jiraData['is_demo']);
|
||||
} catch (Throwable $e) {
|
||||
@@ -236,7 +246,7 @@ $recentEmails = [];
|
||||
$unreadEmailCount = 0;
|
||||
$mailNeedsReconsent = false;
|
||||
try {
|
||||
$mailData = microsoft_fetch_inbox_messages($userId, 5);
|
||||
$mailData = microsoft_fetch_inbox_messages($userId, 5, false, $forceRefresh);
|
||||
$recentEmails = $mailData['messages'] ?? [];
|
||||
$unreadEmailCount = (int)($mailData['unread_count'] ?? 0);
|
||||
$mailNeedsReconsent = !empty($mailData['needs_reconsent']);
|
||||
|
||||
Reference in New Issue
Block a user