| 180 | | $modinfo = module_getinfo('timeconditions'); |
|---|
| 181 | | if (is_array($modinfo)) { |
|---|
| 182 | | $ver = $modinfo['timeconditions']['dbversion']; |
|---|
| 183 | | |
|---|
| 184 | | // If previous version was older than 2.5 then migrate the timeconditions to groups |
|---|
| 185 | | // |
|---|
| 186 | | if (version_compare_freepbx($ver,'2.5','lt')) { |
|---|
| 187 | | outn(_("Checking for old timeconditions to upgrade..")); |
|---|
| 188 | | $upgradelist = timeconditions_list_forupgrade(); |
|---|
| 189 | | if (isset($upgradelist)) { |
|---|
| 190 | | // we have old conditions to upgrade |
|---|
| 191 | | // |
|---|
| 192 | | out(_("starting migration")); |
|---|
| 193 | | foreach($upgradelist as $upgrade) { |
|---|
| 194 | | $times[] = $upgrade['time']; |
|---|
| 195 | | $newid = timeconditions_timegroups_add_group_timestrings('migrated-'.$upgrade['displayname'],$times); |
|---|
| 196 | | timeconditions_set_timegroupid($upgrade['timeconditions_id'],$newid); |
|---|
| 197 | | $newtimes = timeconditions_timegroups_get_times($newid); |
|---|
| 198 | | out(sprintf(_("Upgraded %s and created group %s"), $upgrade['displayname'], 'migrated-'.$upgrade['displayname'])); |
|---|
| 199 | | if (!is_array($newtimes)) { |
|---|
| 200 | | out(sprintf(_("%sWARNING:%s No time defined for this condition, please review"),"<font color='red'>","</font>")); |
|---|
| 201 | | } |
|---|
| 202 | | unset($times); |
|---|
| | 180 | $ver = modules_getversion('timeconditions'); |
|---|
| | 181 | if ($ver !== null && version_compare_freepbx($ver,'2.5','lt')) { |
|---|
| | 182 | outn(_("Checking for old timeconditions to upgrade..")); |
|---|
| | 183 | $upgradelist = timeconditions_list_forupgrade(); |
|---|
| | 184 | if (isset($upgradelist)) { |
|---|
| | 185 | // we have old conditions to upgrade |
|---|
| | 186 | // |
|---|
| | 187 | out(_("starting migration")); |
|---|
| | 188 | foreach($upgradelist as $upgrade) { |
|---|
| | 189 | $times[] = $upgrade['time']; |
|---|
| | 190 | $newid = timeconditions_timegroups_add_group_timestrings('migrated-'.$upgrade['displayname'],$times); |
|---|
| | 191 | timeconditions_set_timegroupid($upgrade['timeconditions_id'],$newid); |
|---|
| | 192 | $newtimes = timeconditions_timegroups_get_times($newid); |
|---|
| | 193 | out(sprintf(_("Upgraded %s and created group %s"), $upgrade['displayname'], 'migrated-'.$upgrade['displayname'])); |
|---|
| | 194 | if (!is_array($newtimes)) { |
|---|
| | 195 | out(sprintf(_("%sWARNING:%s No time defined for this condition, please review"),"<font color='red'>","</font>")); |
|---|