Skip to content

Commit

Permalink
Merge branch 'MDL-36126_m24' of https://github.com/markn86/moodle int…
Browse files Browse the repository at this point in the history
…o MOODLE_24_STABLE
  • Loading branch information
danpoltawski committed Aug 26, 2013
2 parents 1e27536 + 0534f2d commit 433bba6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backup/util/loggers/database_logger.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ protected function action($message, $level, $options = null) {
if ($this->levelcol) {
$columns[$this->levelcol] = $level;
}
$columns[$this->messagecol] = $message; //TODO: should this be cleaned?
$message = clean_param($message, PARAM_NOTAGS);
// Check if the message exceeds the 255 character limit in the database,
// if it does, shorten it so that it can be inserted successfully.
if (textlib::strlen($message) > 255) {
$message = textlib::substr($message, 0, 252) . '...';
}
$columns[$this->messagecol] = $message;
return $this->insert_log_record($this->logtable, $columns);
}

Expand All @@ -69,6 +75,6 @@ protected function insert_log_record($table, $columns) {
// to preserve DB logs if the whole backup/restore transaction is
// rollback
global $DB;
return $DB->insert_record($this->logtable, $columns, false); // Don't return inserted id
return $DB->insert_record($table, $columns, false); // Don't return inserted id
}
}

0 comments on commit 433bba6

Please sign in to comment.