mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 00:29:38 +01:00
Instead of new and old values, store unified diff in database for multiline strings
This commit is contained in:
parent
f71b9ba093
commit
ae000be2bc
@ -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]);
|
||||
|
@ -84,7 +84,8 @@
|
||||
"egroupware/tracker": "self.version",
|
||||
"egroupware/z-push-dev": "self.version",
|
||||
"egroupware/activesync": "self.version",
|
||||
"egroupware/adodb-php": "self.version"
|
||||
"egroupware/adodb-php": "self.version",
|
||||
"pear-pear.horde.org/Horde_Text_Diff": "^2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user