MDL-45250 add debugging message to deprecated add_to_log()

This commit is contained in:
Petr Skoda 2014-04-24 10:29:05 +08:00
parent 14f820c79b
commit b33da4bfe3
2 changed files with 6 additions and 11 deletions

View File

@ -70,10 +70,10 @@ class logstore_legacy_store_testcase extends advanced_testcase {
$this->setUser($user2);
add_to_log($course1->id, 'xxxx', 'yyyy', '', '7', 0, 0);
//$this->assertDebuggingCalled();
$this->assertDebuggingCalled();
add_to_log($course2->id, 'aaa', 'bbb', 'info.php', '666', $module2->cmid, $user1->id);
//$this->assertDebuggingCalled();
$this->assertDebuggingCalled();
$logs = $DB->get_records('log', array(), 'id ASC');
$this->assertCount(4, $logs);
@ -143,7 +143,7 @@ class logstore_legacy_store_testcase extends advanced_testcase {
\logstore_legacy\event\unittest_executed::create(
array('context' => \context_system::instance(), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
add_to_log($course1->id, 'xxxx', 'yyyy', '', '7', 0, 0);
//$this->assertDebuggingCalled();
$this->assertDebuggingCalled();
$this->assertEquals(4, $DB->count_records('log'));
// Another way to disable legacy completely.
@ -154,7 +154,7 @@ class logstore_legacy_store_testcase extends advanced_testcase {
\logstore_legacy\event\unittest_executed::create(
array('context' => \context_system::instance(), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
add_to_log($course1->id, 'xxxx', 'yyyy', '', '7', 0, 0);
//$this->assertDebuggingCalled();
$this->assertDebuggingCalled();
$this->assertEquals(4, $DB->count_records('log'));
// Set everything back.
set_config('enabled_stores', '', 'tool_log');

View File

@ -31,11 +31,7 @@
defined('MOODLE_INTERNAL') || die();
/**
* Add an entry to the log table.
*
* Add an entry to the log table. These are "action" focussed rather
* than web server hits, and provide a way to easily reconstruct what
* any particular student has been doing.
* Add an entry to the legacy log table.
*
* @deprecated since 2.7 use new events instead
*
@ -49,8 +45,7 @@ defined('MOODLE_INTERNAL') || die();
* @return void
*/
function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user=0) {
// TODO: Uncomment after all add_to_log() are removed from standard distribution - ideally before 2.7 release.
//debugging('ideally all add_to_log() calls should be replaced() with new events', DEBUG_DEVELOPER);
debugging('add_to_log() has been deprecated, please rewrite your code to the new events API', DEBUG_DEVELOPER);
// This is a nasty hack that allows us to put all the legacy stuff into legacy storage,
// this way we may move all the legacy settings there too.