mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
MDL-44661 fix legacy log reader to ignore new anonymous field
This commit is contained in:
parent
bc29320285
commit
454c7b5d39
@ -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 */
|
||||
|
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user