From 8e9fa6b1a282f22cc0972640168ccd2e694f5062 Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Wed, 19 Sep 2007 07:23:01 +0000 Subject: [PATCH] accesslib: mark_context_dirty() - fix race condition We had a 1s race condition where a user could get their rights loaded at the exact time an admin is changing roles/caps and see the "old" data. Or even see a half-updated view of the access controls. Yuck. So we fix the race condition backdating the dirtyness. Cheap, but effective. And then we backdate it some more to cover for minor clock flutter on clusters (you still need ntp however!). --- lib/accesslib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/accesslib.php b/lib/accesslib.php index 344e805444..d122577b89 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -4978,7 +4978,10 @@ function mark_context_dirty($path) { // only if it is a non-empty string if (is_string($path) && $path !== '') { - set_config($path, time(), 'accesslib/dirtycontexts'); + // The timestamp is 2s in the past to cover for + // - race conditions within the 1s granularity + // - very small clock offsets in clusters (use ntpd!) + set_config($path, time()-2, 'accesslib/dirtycontexts'); } } -- 2.39.5