From 79f6b384d48df62fc5983cc95be6e5c30f978295 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Thu, 4 Jul 2013 13:55:27 +0800 Subject: [PATCH] MDL-40406 libraries: Deprecate build_context_path() --- lib/accesslib.php | 11 ----------- lib/deprecatedlib.php | 13 +++++++++++++ lib/tests/accesslib_test.php | 1 + lib/upgrade.txt | 1 + 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/accesslib.php b/lib/accesslib.php index 5e551b5614e..d7a2f054c4d 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -7230,17 +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. -/** - * Populate context.path and context.depth where missing. - * - * @deprecated since 2.2, use context_helper::build_all_paths() instead - * @param bool $force force a complete rebuild of the path and depth fields, defaults to false - * @return void - */ -function build_context_path($force = false) { - context_helper::build_all_paths($force); -} - /** * Rebuild all related context depth and path caches * diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index c1a15e629d3..70b6307bdd8 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -5013,3 +5013,16 @@ function cleanup_contexts() { context_helper::cleanup_instances(); return true; } + +/** + * Populate context.path and context.depth where missing. + * + * @see context_helper::build_all_paths() + * @deprecated since 2.2 + * @param bool $force force a complete rebuild of the path and depth fields, defaults to false + * @return void + */ +function build_context_path($force = false) { + debugging('build_context_path() is deprecated, please use context_helper::build_all_paths() instead.', DEBUG_DEVELOPER); + context_helper::build_all_paths($force); +} diff --git a/lib/tests/accesslib_test.php b/lib/tests/accesslib_test.php index efcd87c8d8a..ddde1748997 100644 --- a/lib/tests/accesslib_test.php +++ b/lib/tests/accesslib_test.php @@ -2389,6 +2389,7 @@ class accesslib_testcase extends advanced_testcase { $DB->set_field('context', 'depth', 0, array('contextlevel'=>CONTEXT_BLOCK)); build_context_path(); + $this->assertDebuggingCalled('build_context_path() is deprecated, please use context_helper::build_all_paths() instead.', DEBUG_DEVELOPER); $this->assertFalse($DB->record_exists('context', array('depth'=>0))); $lastcourse = $DB->get_field_sql("SELECT MAX(id) FROM {course}"); diff --git a/lib/upgrade.txt b/lib/upgrade.txt index be2cf717207..3ede8bc7c84 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -14,6 +14,7 @@ information provided here is intended especially for developers. * get_child_contexts() is deprecated, please use $context->get_child_contexts(). * create_contexts() is deprecated, please use context_helper::create_instances(). * cleanup_contexts() is deprecated, please use context_helper::cleanup_instances(). +* build_context_path() is deprecated, please use context_helper::build_all_paths(). === 2.5.1 ===