Skip to content

Commit

Permalink
MDL-45250 add debugging message to deprecated add_to_log()
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Apr 25, 2014
1 parent 14f820c commit b33da4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
8 changes: 4 additions & 4 deletions admin/tool/log/store/legacy/tests/store_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ public function test_log_writing() {

$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);
Expand Down Expand Up @@ -143,7 +143,7 @@ public function test_log_writing() {
\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.
Expand All @@ -154,7 +154,7 @@ public function test_log_writing() {
\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');
Expand Down
9 changes: 2 additions & 7 deletions lib/deprecatedlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -49,8 +45,7 @@
* @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.
Expand Down

0 comments on commit b33da4b

Please sign in to comment.