MDL-40406 libraries: Deprecate cleanup_contexts()

This commit is contained in:
Frederic Massart 2013-07-04 13:51:39 +08:00
parent 9fdbf620a4
commit 84378a57b9
4 changed files with 15 additions and 11 deletions

View file

@ -7230,17 +7230,6 @@ class context_block extends context {
// before removing devs will be warned with a debugging message first, // 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 // then we will add error message and only after that we can remove the functions
// completely. // completely.
/**
* Remove stale context records
*
* @deprecated since 2.2, use context_helper::cleanup_instances() instead
* @return bool
*/
function cleanup_contexts() {
context_helper::cleanup_instances();
return true;
}
/** /**
* Populate context.path and context.depth where missing. * Populate context.path and context.depth where missing.
* *

View file

@ -5000,3 +5000,16 @@ function create_contexts($contextlevel = null, $buildpaths = true) {
debugging('create_contexts() is deprecated, please use context_helper::create_instances() instead.', DEBUG_DEVELOPER); debugging('create_contexts() is deprecated, please use context_helper::create_instances() instead.', DEBUG_DEVELOPER);
context_helper::create_instances($contextlevel, $buildpaths); context_helper::create_instances($contextlevel, $buildpaths);
} }
/**
* Remove stale context records.
*
* @see context_helper::cleanup_instances()
* @deprecated since 2.2
* @return bool
*/
function cleanup_contexts() {
debugging('cleanup_contexts() is deprecated, please use context_helper::cleanup_instances() instead.', DEBUG_DEVELOPER);
context_helper::cleanup_instances();
return true;
}

View file

@ -2400,6 +2400,7 @@ class accesslib_testcase extends advanced_testcase {
$DB->delete_records('block_instances', array('parentcontextid'=>$frontpagepagecontext->id)); $DB->delete_records('block_instances', array('parentcontextid'=>$frontpagepagecontext->id));
$DB->delete_records('course_modules', array('id'=>$frontpagepagecontext->instanceid)); $DB->delete_records('course_modules', array('id'=>$frontpagepagecontext->instanceid));
cleanup_contexts(); cleanup_contexts();
$this->assertDebuggingCalled('cleanup_contexts() is deprecated, please use context_helper::cleanup_instances() instead.', DEBUG_DEVELOPER);
$count = 1; //system $count = 1; //system
$count += $DB->count_records('user', array('deleted'=>0)); $count += $DB->count_records('user', array('deleted'=>0));
$count += $DB->count_records('course_categories'); $count += $DB->count_records('course_categories');

View file

@ -13,6 +13,7 @@ information provided here is intended especially for developers.
* get_parent_contextid() is deprecated, please use $context->get_parent_context(). * get_parent_contextid() is deprecated, please use $context->get_parent_context().
* get_child_contexts() is deprecated, please use $context->get_child_contexts(). * get_child_contexts() is deprecated, please use $context->get_child_contexts().
* create_contexts() is deprecated, please use context_helper::create_instances(). * create_contexts() is deprecated, please use context_helper::create_instances().
* cleanup_contexts() is deprecated, please use context_helper::cleanup_instances().
=== 2.5.1 === === 2.5.1 ===