17 require_once SQ_INCLUDE_PATH.
'/asset_management.inc';
43 if (!parent::_upgrade($current_version))
return FALSE;
45 if (version_compare($current_version,
'0.3',
'<')) {
46 pre_echo(
'UPGRADING TRIGGER CONDITION TREE LOCATION FROM v < 0.3');
48 $tm = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'trigger_manager');
49 $trigger_list = $tm->getTriggerList();
50 foreach ($trigger_list as $info){
51 $trigger = $tm->getAsset($info[
'id']);
52 $conditions = $trigger->attr(
'conditions');
54 foreach ($conditions as &$condition_info){
55 if ($condition_info[
'type'] ==
'trigger_condition_tree_location'){
56 if (!empty($condition_info[
'data'][
'assetid'])){
57 $condition_info[
'data'][
'assetids'] = Array($condition_info[
'data'][
'assetid']);
58 $condition_info[
'data'][
'immed_child'] = Array(
59 $condition_info[
'data'][
'assetid'] => $condition_info[
'data'][
'immed_child']
61 $condition_info[
'data'][
'propagate'] = Array(
62 $condition_info[
'data'][
'assetid'] => $condition_info[
'data'][
'propagate']
65 unset($condition_info[
'data'][
'assetid']);
66 unset($condition_info[
'data'][
'treeid']);
71 $trigger->setAttrValue(
'conditions', $conditions);
72 $trigger->saveAttributes();
73 unset($condition_info);