mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-17 05:48:43 +02:00
Fixed event db snapshot record mismatch
This commit is contained in:
@@ -130,9 +130,6 @@ class outagedb {
|
||||
// Create calendar entry.
|
||||
calendar::create($outage);
|
||||
} else {
|
||||
// Remove the createdby field so it does not get updated.
|
||||
unset($outage->createdby);
|
||||
$DB->update_record('auth_outage', $outage);
|
||||
|
||||
$other = (array) $outage;
|
||||
$other['title'] = $outage->get_title();
|
||||
@@ -140,9 +137,14 @@ class outagedb {
|
||||
'objectid' => $outage->id,
|
||||
'other' => $other,
|
||||
]);
|
||||
|
||||
$event->add_record_snapshot('auth_outage', (object)(array) $outage);
|
||||
$event->trigger();
|
||||
|
||||
// Remove the createdby field so it does not get updated.
|
||||
unset($outage->createdby);
|
||||
$DB->update_record('auth_outage', $outage);
|
||||
|
||||
// Update calendar entry.
|
||||
calendar::update($outage);
|
||||
}
|
||||
|
||||
@@ -281,7 +281,17 @@ class outage {
|
||||
*/
|
||||
private function adjust_field_types() {
|
||||
// Adjust int fields.
|
||||
$fs = ['createdby', 'id', 'lastmodified', 'modifiedby', 'starttime', 'stoptime', 'warntime', 'finished'];
|
||||
$fs = [
|
||||
'id',
|
||||
'starttime',
|
||||
'stoptime',
|
||||
'warntime',
|
||||
'finished',
|
||||
'createdby',
|
||||
'lastmodified',
|
||||
'modifiedby',
|
||||
];
|
||||
|
||||
foreach ($fs as $f) {
|
||||
$this->$f = ($this->$f === null) ? null : (int)$this->$f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user