mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
Do not store a diff for encrypted values, that is not useful.
This commit is contained in:
parent
53bff47792
commit
0324c7d6e6
@ -32,6 +32,13 @@ class History
|
|||||||
*/
|
*/
|
||||||
var $db;
|
var $db;
|
||||||
const TABLE = 'egw_history_log';
|
const TABLE = 'egw_history_log';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PGP begin / end flags so we can handle them specially
|
||||||
|
*/
|
||||||
|
const BEGIN_PGP = '-----BEGIN PGP MESSAGE-----';
|
||||||
|
const END_PGP = '-----END PGP MESSAGE-----';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* App.name this class is instanciated for / working on
|
* App.name this class is instanciated for / working on
|
||||||
*
|
*
|
||||||
@ -330,8 +337,24 @@ class History
|
|||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function needs_diff($name, $value)
|
/**
|
||||||
|
* Check to see if we would rather store a unified diff of the changes rather
|
||||||
|
* than full old and new values. We don't care for small text values, but
|
||||||
|
* any long or multi-line values will be diff-ed.
|
||||||
|
*
|
||||||
|
* We do not store a diff of encrypted values, since that winds up as nonsense.
|
||||||
|
*
|
||||||
|
* @param string $name Field name, used to do some decision making
|
||||||
|
* @param string $value Value, either old or new
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function needs_diff($name, $value)
|
||||||
{
|
{
|
||||||
|
// No diff on encrypted content
|
||||||
|
if(strpos($value, static::BEGIN_PGP) == 0 && strpos($value, static::END_PGP) !== FALSE)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return $name == 'note' || // Addressbook
|
return $name == 'note' || // Addressbook
|
||||||
strpos($name, 'description') !== false || // Calendar, Records, Timesheet, ProjectManager, Resources
|
strpos($name, 'description') !== false || // Calendar, Records, Timesheet, ProjectManager, Resources
|
||||||
$name == 'De' || // Tracker, InfoLog
|
$name == 'De' || // Tracker, InfoLog
|
||||||
|
@ -460,7 +460,7 @@ abstract class Tracking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (is_string($data[$name]) && is_string($old[$name]) && (
|
else if (is_string($data[$name]) && is_string($old[$name]) && (
|
||||||
strpos($data[$name], PHP_EOL) !== FALSE || strpos($old[$name], PHP_EOL) !== FALSE))
|
$this->historylog->needs_diff ($name, $data[$name]) || $this->historylog->needs_diff ($name, $old[$name])))
|
||||||
{
|
{
|
||||||
// Multiline string, just store diff
|
// Multiline string, just store diff
|
||||||
$diff = new \Horde_Text_Diff('auto', array(explode("\n",$old[$name]), explode("\n",$data[$name])));
|
$diff = new \Horde_Text_Diff('auto', array(explode("\n",$old[$name]), explode("\n",$data[$name])));
|
||||||
|
Loading…
Reference in New Issue
Block a user