fix permanent creation of temp channels

master
lub 10 years ago
parent 777d05f3fb
commit 295c75b65b

@ -17,6 +17,7 @@ foreach($roots as $root) {
$groups = $sub->subChannelList(); $groups = $sub->subChannelList();
$groupCount = count($groups); $groupCount = count($groups);
$availablechannel = false;
$i = 0; $i = 0;
foreach($groups as $group) { foreach($groups as $group) {
if(catchExceptions($group['channel_name'], $exceptions)) { if(catchExceptions($group['channel_name'], $exceptions)) {
@ -24,14 +25,17 @@ foreach($roots as $root) {
continue; continue;
} }
$i++; $i++;
if($i == $groupCount AND $delete == false) { if($group['total_clients'] == 0) {
$availablechannel = true;
}
if($i == $groupCount AND $availablechannel = false) {
$regex = '#([0-9]{1,3})#e'; $regex = '#([0-9]{1,3})#e';
$replacement = '("$1" + 1)'; $replacement = '("$1" + 1)';
$newName = preg_replace($regex, $replacement, $group['channel_name']); $newName = preg_replace($regex, $replacement, $group['channel_name']);
createChannel($server, $newName, $sub, $options); createChannel($server, $newName, $sub, $options);
} }
} }
if($i == 0) { if(empty($groups) OR $i == 0) {
createChannel($server, $default, $sub, $options, array('channel_flag_permanent' => TRUE)); createChannel($server, $default, $sub, $options, array('channel_flag_permanent' => TRUE));
} }
} }

Loading…
Cancel
Save