mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-10 00:37:54 +02:00
Instead of new and old values, store unified diff in database for multiline strings
This commit is contained in:
@ -18,6 +18,8 @@ use EGroupware\Api;
|
||||
// explicitly reference classes still in phpgwapi or otherwise outside api
|
||||
use notifications;
|
||||
|
||||
use Text_Diff_Renderer_unified;
|
||||
|
||||
/**
|
||||
* Abstract base class for trackering:
|
||||
* - logging all modifications of an entry
|
||||
@ -451,6 +453,19 @@ abstract class Tracking
|
||||
$this->historylog->add($name,$data[$this->id_field],$added[$i],$removed[$i]);
|
||||
}
|
||||
}
|
||||
else if (is_string($data[$name]) && is_string($old[$name]) && (
|
||||
strpos($data[$name], PHP_EOL) !== FALSE || strpos($old[$name], PHP_EOL) !== FALSE))
|
||||
{
|
||||
// Multiline string, just store diff
|
||||
$diff = new \Text_Diff('auto', array(explode("\n",$data[$name]), explode("\n",$old[$name])));
|
||||
$renderer = new \Text_Diff_Renderer_unified();
|
||||
$this->historylog->add(
|
||||
$status,
|
||||
$data[$this->id_field],
|
||||
$renderer->render($diff),
|
||||
'***diff***'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.' IDField:'.array2string($this->id_field).' ->'.$data[$this->id_field].' New:'.$data[$name].' Old:'.$old[$name]);
|
||||
|
Reference in New Issue
Block a user