fix: Truncate the change field in log entries if it becomes humongous

- solves a rare situation with massive PGP keys breaking user additions / edits
pull/2229/head
iglocska 2017-05-29 07:59:44 +02:00
parent 165266b072
commit 3cccbb9c5c
1 changed files with 5 additions and 4 deletions

View File

@ -87,10 +87,11 @@ class Log extends AppModel {
}
if (!isset($this->data['Log']['created'])) $this->data['Log']['created'] = date('Y-m-d H:i:s');
if (!isset($this->data['Log']['org'])) $this->data['Log']['org'] = 'SYSTEM';
if (isset($this->data['Log']['title'])) {
if (strlen($this->data['Log']['title']) >= 65535) {
$this->data['Log']['title'] = substr($this->data['Log']['title'], 0, 65532) . '...';
}
if (isset($this->data['Log']['title']) && strlen($this->data['Log']['title']) >= 65535) {
$this->data['Log']['title'] = substr($this->data['Log']['title'], 0, 65532) . '...';
}
if (isset($this->data['Log']['change']) && strlen($this->data['Log']['change']) >= 65535) {
$this->data['Log']['change'] = substr($this->data['Log']['change'], 0, 65532) . '...';
}
return true;