MDL-44661 fix legacy log reader to ignore new anonymous field

This commit is contained in:
Petr Škoda 2014-03-20 17:06:28 +08:00
parent bc29320285
commit 454c7b5d39
2 changed files with 7 additions and 1 deletions

View File

@ -39,7 +39,8 @@ class store implements \tool_log\log\store, \core\log\sql_select_reader {
'timecreated' => 'time',
'courseid' => 'course',
'contextinstanceid' => 'cmid',
'origin' => 'ip'
'origin' => 'ip',
'anonymous' => 0,
);
/** @var string Regex to replace the crud params */

View File

@ -213,6 +213,11 @@ class logstore_legacy_store_testcase extends advanced_testcase {
list($updatewhere, $replaceparams) = \logstore_legacy\test\unittest_logstore_legacy::replace_sql_legacy($selectwhere, $params);
$this->assertEquals("edulevel = 0 and action LIKE '%update%' OR action NOT LIKE '%view%' AND action NOT LIKE '%report%' or action NOT LIKE '%delete%'", $updatewhere);
// The anonymous select returns all data.
$selectwhere = "anonymous = 0";
list($updatewhere, $replaceparams) = \logstore_legacy\test\unittest_logstore_legacy::replace_sql_legacy($selectwhere, $params);
$this->assertSame("0 = 0", $updatewhere);
// Test legacy field names are mapped.
$selectwhere = "timecreated = :timecreated and courseid = :courseid and contextinstanceid = :contextinstanceid and origin = :origin";
$params = array('timecreated' => 2, 'courseid' => 3, 'contextinstanceid' => 4, 'origin' => 5 );