From c654e350071a68ab7ce813599154d92c946b5c5d Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Fri, 14 Dec 2018 13:29:36 +0100 Subject: [PATCH] MDL-63677 core_user: Avoid redirection during signup Purge cache just for the current user to avoid redirection when 2 simultaneous users try to sign up at the same time and some policy has to be agreed. The 'createduser' invalidation event has been removed also because is not used any more. Thanks John Azinheira for spotting it! --- lib/db/caches.php | 5 +---- user/lib.php | 5 +++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/db/caches.php b/lib/db/caches.php index aa265c6da9d..567a146948b 100644 --- a/lib/db/caches.php +++ b/lib/db/caches.php @@ -382,9 +382,6 @@ $definitions = array( 'mode' => cache_store::MODE_SESSION, 'simplekeys' => true, 'simpledata' => true, - 'ttl' => 1800, - 'invalidationevents' => array( - 'createduser', - ) + 'ttl' => 1800 ), ); diff --git a/user/lib.php b/user/lib.php index 21b0abed88e..c8b5ccc5eb7 100644 --- a/user/lib.php +++ b/user/lib.php @@ -126,8 +126,9 @@ function user_create_user($user, $updatepassword = true, $triggerevent = true) { \core\event\user_created::create_from_userid($newuserid)->trigger(); } - // Purge the associated caches. - cache_helper::purge_by_event('createduser'); + // Purge the associated caches for the current user only. + $presignupcache = \cache::make('core', 'presignup'); + $presignupcache->purge_current_user(); return $newuserid; }