From ce2b21509ea36660a2929271e3622ff229aa084c Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Mon, 1 Jul 2013 14:43:48 +0800 Subject: [PATCH] MDL-35009 Libraries: Deprecated get_context_instance_by_id --- lib/accesslib.php | 13 ------------- lib/deprecatedlib.php | 16 ++++++++++++++++ lib/upgrade.txt | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/accesslib.php b/lib/accesslib.php index dbb20318e70..57a28754084 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -7222,19 +7222,6 @@ function get_context_instance($contextlevel, $instance = 0, $strictness = IGNORE } } -/** - * Get a context instance as an object, from a given context id. - * - * @deprecated since 2.2, use context::instance_by_id($id) instead - * @param int $id context id - * @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; - * MUST_EXIST means throw exception if no record or multiple records found - * @return context|bool the context object or false if not found. - */ -function get_context_instance_by_id($id, $strictness = IGNORE_MISSING) { - return context::instance_by_id($id, $strictness); -} - /** * Recursive function which, given a context, find all parent context ids, * and return the array in reverse order, i.e. parent first, then grand diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 05a282a6594..b728fefcb08 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -4849,3 +4849,19 @@ function can_use_rotated_text() { debugging('can_use_rotated_text() is deprecated since Moodle 2.5. JS feature detection is used automatically.', DEBUG_DEVELOPER); return true; } + +/** + * Get a context instance as an object, from a given context id. + * + * @deprecated since Moodle 2.2 MDL-35009 - please do not use this function any more. + * @todo MDL-34550 This will be deleted in Moodle 2.8 + * @see context::instance_by_id($id) + * @param int $id context id + * @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; + * MUST_EXIST means throw exception if no record or multiple records found + * @return context|bool the context object or false if not found. + */ +function get_context_instance_by_id($id, $strictness = IGNORE_MISSING) { + debugging('Function get_context_instance_by_id() is deprecated, please use context::instance_by_id($id) instead', DEBUG_DEVELOPER); + return context::instance_by_id($id, $strictness); +} diff --git a/lib/upgrade.txt b/lib/upgrade.txt index de7abfb271d..659460e2078 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -3,7 +3,7 @@ information provided here is intended especially for developers. === 2.6 === * Use new core_component::* plugin listing and component normalisation methods. - +* get_context_instance_by_id() is deprecated, please use context::instance_by_id($id) === 2.5.1 ===