diff --git a/course/view.php b/course/view.php index f7f925dc844..cf3748a4c0d 100644 --- a/course/view.php +++ b/course/view.php @@ -49,7 +49,7 @@ // Prevent caching of this page to stop confusion when changing page after making AJAX changes $PAGE->set_cacheable(false); - preload_course_contexts($course->id); + context_helper::preload_course($course->id); $context = context_course::instance($course->id, MUST_EXIST); // Remove any switched roles before checking login diff --git a/lib/accesslib.php b/lib/accesslib.php index 71b8ce707d2..0617c575b88 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -7230,19 +7230,6 @@ class context_block extends context { // before removing devs will be warned with a debugging message first, // then we will add error message and only after that we can remove the functions // completely. -/** - * Preloads all contexts relating to a course: course, modules. Block contexts - * are no longer loaded here. The contexts for all the blocks on the current - * page are now efficiently loaded by {@link block_manager::load_blocks()}. - * - * @deprecated since 2.2 - * @param int $courseid Course ID - * @return void - */ -function preload_course_contexts($courseid) { - context_helper::preload_course($courseid); -} - /** * Preloads context information together with instances. * Use context_instance_preload() to strip the context info from the record and cache the context instance. diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index cdedf65011e..2ee977fa7a8 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -5042,3 +5042,18 @@ function rebuild_contexts(array $fixcontexts) { } context_helper::build_all_paths(false); } + +/** + * Preloads all contexts relating to a course: course, modules. Block contexts + * are no longer loaded here. The contexts for all the blocks on the current + * page are now efficiently loaded by {@link block_manager::load_blocks()}. + * + * @deprecated since Moodle 2.2 + * @see context_helper::preload_course() + * @param int $courseid Course ID + * @return void + */ +function preload_course_contexts($courseid) { + debugging('preload_course_contexts() is deprecated, please use context_helper::preload_course() instead.', DEBUG_DEVELOPER); + context_helper::preload_course($courseid); +} diff --git a/lib/modinfolib.php b/lib/modinfolib.php index fc93e14fe23..1355b081f7e 100644 --- a/lib/modinfolib.php +++ b/lib/modinfolib.php @@ -288,7 +288,7 @@ class course_modinfo extends stdClass { } // If we haven't already preloaded contexts for the course, do it now - preload_course_contexts($course->id); + context_helper::preload_course($course->id); // Loop through each piece of module data, constructing it $modexists = array(); diff --git a/lib/tests/accesslib_test.php b/lib/tests/accesslib_test.php index ea437d8da61..d6532c84282 100644 --- a/lib/tests/accesslib_test.php +++ b/lib/tests/accesslib_test.php @@ -2422,6 +2422,7 @@ class accesslib_testcase extends advanced_testcase { context_helper::reset_caches(); preload_course_contexts($SITE->id); + $this->assertDebuggingCalled('preload_course_contexts() is deprecated, please use context_helper::preload_course() instead.', DEBUG_DEVELOPER); $this->assertEquals(1 + $DB->count_records('course_modules', array('course' => $SITE->id)), context_inspection::test_context_cache_size()); diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 42252b97b15..874bf617e78 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -5,6 +5,7 @@ information provided here is intended especially for developers. * Use new core_component::* plugin listing and component normalisation methods. * Use core_text::* instead of textlib:: and also core_collator::* instead of collatorlib::*. +* Use new function moodleform::mock_submit() to simulate form submission in unit tests (backported). * get_context_instance() is deprecated, please use use context_xxxx::instance(). * get_context_instance_by_id() is deprecated, please use context::instance_by_id($id). * load_temp_role() and remove_temp_roles() can not be used any more. @@ -16,7 +17,7 @@ information provided here is intended especially for developers. * cleanup_contexts() is deprecated, please use context_helper::cleanup_instances(). * build_context_path() is deprecated, please use context_helper::build_all_paths(). * rebuild_contexts() is deprecated, please use $context->reset_paths(). -* Use new function moodleform::mock_submit() to simulate form submission in unit tests (backported). +* preload_course_contexts() is deprecated, please use context_helper::preload_course(). === 2.5.1 ===