From ef1987dcdd9eef321a55eae7d6c4a9f8f5b09e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Wed, 17 Jul 2013 06:40:34 +0200 Subject: [PATCH] MDL-39846 use new special value -1 in $CFG->loglifetime to prevent legacy logging --- lib/classes/event/base.php | 2 +- lib/tests/event_test.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/classes/event/base.php b/lib/classes/event/base.php index 25ab52f5e8f..ff7ecb3d884 100644 --- a/lib/classes/event/base.php +++ b/lib/classes/event/base.php @@ -459,7 +459,7 @@ abstract class base implements \IteratorAggregate { $this->triggered = true; - if (!empty($CFG->loglifetime)) { + if (isset($CFG->loglifetime) and $CFG->loglifetime != -1) { if ($data = $this->get_legacy_logdata()) { call_user_func_array('add_to_log', $data); } diff --git a/lib/tests/event_test.php b/lib/tests/event_test.php index fca042f0010..052ed5e1583 100644 --- a/lib/tests/event_test.php +++ b/lib/tests/event_test.php @@ -29,6 +29,17 @@ require_once(__DIR__.'/fixtures/event_fixtures.php'); class core_event_testcase extends advanced_testcase { + protected function setUp() { + global $CFG; + // No need to always modify log table here. + $CFG->loglifetime = '-1'; + } + + protected function tearDown() { + global $CFG; + $CFG->loglifetime = '0'; + } + public function test_event_properties() { global $USER;