fixes #855 trigger on group deletion

* adding trigger (admin screen)
* adding trigger (API)
* update trigger list
This commit is contained in:
Teatek
2019-02-11 14:02:30 +01:00
committed by Pierrick Le Gall
parent 339c54fa23
commit f308af3e46
3 changed files with 23 additions and 7 deletions

View File

@@ -157,14 +157,17 @@ SELECT name
WHERE group_id = '.$group.'
;';
pwg_query($query);
$query = '
SELECT name
SELECT id, name
FROM '.GROUPS_TABLE.'
WHERE id = '.$group.'
;';
list($groupname) = pwg_db_fetch_row(pwg_query($query));
$group_list = query2array($query, 'id', 'name');
$groupids = array_keys($group_list);
list($groupname) = array_values($group_list);
// destruction of the group
$query = '
DELETE
@@ -172,7 +175,9 @@ SELECT name
WHERE id = '.$group.'
;';
pwg_query($query);
trigger_notify('delete_group', $groupids);
$page['infos'][] = l10n('group "%s" deleted', $groupname);
}
}

View File

@@ -135,11 +135,14 @@ DELETE
pwg_query($query);
$query = '
SELECT name
SELECT id, name
FROM '. GROUPS_TABLE .'
WHERE id IN('. $group_id_string .')
;';
$groupnames = array_from_query($query, 'name');
$group_list = query2array($query, 'id', 'name');
$groupnames = array_values($group_list);
$groupids = array_keys($group_list);
// destruction of the group
$query = '
@@ -149,6 +152,8 @@ DELETE
;';
pwg_query($query);
trigger_notify('delete_group', $groupids);
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
invalidate_user_cache();

View File

@@ -83,6 +83,12 @@ array(
'vars' => array('array', 'ids'),
'files' => array('admin\include\functions.inc.php (delete_categories)'),
),
array(
'name' => 'delete_group',
'type' => 'trigger_notify',
'vars' => array('array', 'groupids'),
'files' => array('admin\group_list.php','admin\include\functions.inc.php (delete_group)'),
),
array(
'name' => 'delete_elements',
'type' => 'trigger_notify',