From 9c8c5f2d01ceee87e23fc8cb026d44b9f2f59bf4 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Fri, 16 May 2014 17:07:14 +0800 Subject: [PATCH] MDL-41746 External api: Allow multiple calls to validate_context at different levels (Only from webservices) --- lib/pagelib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pagelib.php b/lib/pagelib.php index c650dadf148..d39b5f2a0db 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -965,7 +965,11 @@ class moodle_page { } else { // We do not want devs to do weird switching of context levels on the fly because we might have used // the context already such as in text filter in page title. - debugging("Coding problem: unsupported modification of PAGE->context from {$current} to {$context->contextlevel}"); + // This is explicitly allowed for webservices though which may + // call "external_api::validate_context on many contexts in a single request. + if (!WS_SERVER) { + debugging("Coding problem: unsupported modification of PAGE->context from {$current} to {$context->contextlevel}"); + } } }