forked from extern/egroupware
update script to remove hashes/non-email-addresses from egw_history_log.share_email
This commit is contained in:
parent
bea880d9b1
commit
94c98718ef
@ -11,7 +11,7 @@
|
||||
/* Basic information about this app */
|
||||
$setup_info['api']['name'] = 'api';
|
||||
$setup_info['api']['title'] = 'EGroupware API';
|
||||
$setup_info['api']['version'] = '21.1';
|
||||
$setup_info['api']['version'] = '21.1.001';
|
||||
$setup_info['api']['versions']['current_header'] = '1.29';
|
||||
// maintenance release in sync with changelog in doc/rpm-build/debian.changes
|
||||
$setup_info['api']['versions']['maintenance_release'] = '21.1.20210723';
|
||||
|
@ -789,5 +789,18 @@ function api_upgrade20_1_002()
|
||||
*/
|
||||
function api_upgrade20_1_003()
|
||||
{
|
||||
return $GLOBALS['setup_info']['activesync']['currentver'] = '21.1';
|
||||
return $GLOBALS['setup_info']['api']['currentver'] = '21.1';
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove non-email addresses from egw_history_log.share_email
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function api_upgrade21_1()
|
||||
{
|
||||
$GLOBALS['egw_setup']->db->query("UPDATE egw_history_log SET share_email=NULL, history_timestamp=history_timestamp".
|
||||
" WHERE share_email is NOT NULL AND share_email NOT LIKE '%@%'", __LINE__, __FILE__);
|
||||
|
||||
return $GLOBALS['setup_info']['api']['currentver'] = '21.1.001';
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ use EGroupware\Api;
|
||||
/**
|
||||
* Record history logging service
|
||||
*
|
||||
* This class need to be instanciated for EACH app, which wishes to use it!
|
||||
* This class need to be instantiated for EACH app, which wishes to use it!
|
||||
*/
|
||||
class History
|
||||
{
|
||||
@ -59,8 +59,8 @@ class History
|
||||
*/
|
||||
function __construct($appname = '', $user = null)
|
||||
{
|
||||
$this->appname = $appname ? $appname : $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
$this->user = !is_null($user) ? $user : $GLOBALS['egw_info']['user']['account_id'];
|
||||
$this->appname = $appname ?: $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
$this->user = $user ?: $GLOBALS['egw_info']['user']['account_id'];
|
||||
|
||||
if(is_object($GLOBALS['egw_setup']->db))
|
||||
{
|
||||
@ -148,6 +148,7 @@ class History
|
||||
if($new_value != $old_value)
|
||||
{
|
||||
$share_with = static::get_share_with($appname, $id);
|
||||
|
||||
$GLOBALS['egw']->db->insert(self::TABLE, array(
|
||||
'history_record_id' => $id,
|
||||
'history_appname' => $appname,
|
||||
@ -172,11 +173,11 @@ class History
|
||||
* @param $appname
|
||||
* @param $id
|
||||
*
|
||||
* @return string
|
||||
* @return ?string
|
||||
*/
|
||||
static function get_share_with($appname, $id)
|
||||
{
|
||||
$share_with = '';
|
||||
$share_with = null;
|
||||
foreach(isset($GLOBALS['egw']->sharing) ? $GLOBALS['egw']->sharing : [] as $token => $share_obj)
|
||||
{
|
||||
// Make sure share is of the correct type to access an entry, and it is the correct entry
|
||||
|
Loading…
Reference in New Issue
Block a user