Ignore:
Timestamp:
Jul 8, 2013, 12:55:56 AM (11 years ago)
Author:
chronos
Message:
  • Opraveno: Generování čísla služby při generování síťových front.
  • Přidáno: Kontrola duplicity generovaných jmen u front.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfigRouterOS/Generators/Queue.php

    r554 r555  
    1515$Routerboard->HostName = $Config['MainRouter']['HostName'];
    1616$Routerboard->Debug = true;
     17
     18$UsedNames = array();
     19
     20function CheckName($Name)
     21{
     22  global $UsedNames;
     23 
     24  if(in_array($Name, $UsedNames)) die("\n".'Duplicate name: '.$Name);
     25  else $UsedNames[] = $Name;
     26}
    1727
    1828$Finance = &$System->Modules['Finance'];
     
    7282    $UserMaxSpeedIn = round($Service['InternetSpeedMax'] / $InDivider) * 1000;
    7383    $UserMaxSpeedOut = round($Service['InternetSpeedMax'] / $OutDivider) * 1000;
    74     if($ServiceIndex == 1)
    75     {
    76       $ItemsQueue[] = array('name' => $MemberName.'-out', 'limit-at' => $SpeedIn, 'max-limit' => $UserMaxSpeedIn, 'parent' => 'main-out');
    77       $ItemsQueue[] = array('name' => $MemberName.'-in', 'limit-at' => $SpeedOut, 'max-limit' => $UserMaxSpeedOut, 'parent' => 'main-in');
    78     }
     84    $ItemsQueue[] = array('name' => $MemberName.'-out', 'limit-at' => $SpeedIn, 'max-limit' => $UserMaxSpeedIn, 'parent' => 'main-out');
     85    $ItemsQueue[] = array('name' => $MemberName.'-in', 'limit-at' => $SpeedOut, 'max-limit' => $UserMaxSpeedOut, 'parent' => 'main-in');
     86    CheckName($MemberName.'-out');
     87    CheckName($MemberName.'-in');
    7988
    8089    $Filter = '(`Used` = 1) AND (`Service` = '.$Service['RelId'].')';
     
    108117        $PacketMark = GetMarkByComment($Name.'-in');
    109118        $ItemsQueue[] = array('name' => $Name.'-in', 'limit-at' => $HostSpeedOut, 'max-limit' => $UserMaxSpeedOut, 'parent' => $MemberName.'-in', 'packet-mark' => $PacketMark);
     119        CheckName($Name.'-out');
     120        CheckName($Name.'-in');
    110121      }
    111122    }
     
    122133      $PacketMark = GetMarkByComment($Subnet['Name'].'-in');
    123134      $ItemsQueue[] = array('name' => $Subnet['Name'].'-in', 'limit-at' => $HostSpeedOut, 'max-limit' => $UserMaxSpeedOut, 'parent' => $MemberName.'-in', 'packet-mark' => $PacketMark);
     135      CheckName($Subnet['Name'].'-out');
     136      CheckName($Subnet['Name'].'-in');
    124137    }
    125138    echo("\n");
     139    $ServiceIndex++;
    126140  }
    127141}
Note: See TracChangeset for help on using the changeset viewer.