Changeset 970 for trunk


Ignore:
Timestamp:
Jul 17, 2024, 10:48:28 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Service internet speed min and max used as contracted speeds. Real speed will be calculated with bonus speed and further queues calculations.
  • Added: Bonus internet speed service field.
  • Modified: Few PHP 8.3 fixes.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/BaseView.php

    r965 r970  
    77  public bool $FormatHTML = false;
    88  public bool $ShowRuntimeInfo = false;
    9   public bool $RawPage = false;
    10   public bool $BasicHTML = false;
    119  public string $ParentClass = '';
    1210  public string $Title;
     
    8583
    8684    $Output .= '</head><body'.$BodyParam.'>';
    87     if ($this->BasicHTML == false)
     85    if ($Page->BasicHTML == false)
    8886    {
    8987      //$Output .= '<div class="MainTitle">'.$Title.'</div>';
     
    9997  }
    10098
    101   function ShowFooter(): string
     99  function ShowFooter(Page $Page): string
    102100  {
    103101    global $Revision, $ReleaseTime;
     
    105103    $Time = round(GetMicrotime() - Core::Cast($this->System)->ScriptTimeStart, 2);
    106104    $Output = '';
    107     if ($this->BasicHTML == false)
     105    if ($Page->BasicHTML == false)
    108106    {
    109107      $Output .= '<div id="Footer">'.
     
    125123    if ($Page->RawPage == false)
    126124    {
    127       $Output = $this->ShowHeader($Page).$Output.$this->ShowFooter();
     125      $Output = $this->ShowHeader($Page).$Output.$this->ShowFooter($Page);
    128126      if ($this->FormatHTML == true) $Output = $this->FormatOutput($Output);
    129127    }
  • trunk/Application/UpdateTrace.php

    r967 r970  
    22592259      "VALUES (NULL , 'Měsíční přehled', '".$DbRow['Id']."', '".$ActionId."', '1');");   
    22602260  }
     2261}
     2262
     2263function UpdateTo970(UpdateManager $Manager): void
     2264{
     2265  $Manager->Execute('ALTER TABLE `Service` ADD `InternetSpeedBonus` INT NULL DEFAULT NULL AFTER `InternetSpeedMin`;');
    22612266}
    22622267
     
    23752380      953 => array('Revision' => 957, 'Function' => 'UpdateTo957'),
    23762381      957 => array('Revision' => 967, 'Function' => 'UpdateTo967'),
     2382      967 => array('Revision' => 970, 'Function' => 'UpdateTo970'),
    23772383    );
    23782384  }
  • trunk/Application/Version.php

    r969 r970  
    11<?php
    22
    3 $Revision = 969; // Subversion revision
    4 $DatabaseRevision = 967; // SQL structure revision
     3$Revision = 970; // Subversion revision
     4$DatabaseRevision = 970; // SQL structure revision
    55$ReleaseTime = strtotime('2024-07-17');
  • trunk/Modules/Customer/Customer.php

    r968 r970  
    8585        'InternetSpeedMin' => array('Type' => 'Integer', 'Caption' => 'Min. rychlost internetu', 'Default' => '0', 'Suffix' => 'bit/s'),
    8686        'InternetSpeedMax' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost internetu', 'Default' => '0', 'Suffix' => 'bit/s'),
     87        'InternetSpeedBonus' => array('Type' => 'Integer', 'Caption' => 'Bonusová rychlost internetu', 'Default' => '0', 'Suffix' => 'bit/s'),
    8788        'UploadAsymmetry' => array('Type' => 'Integer', 'Caption' => 'Asymetrie odesílání', 'Default' => '1'),
    8889        'Memory' => array('Type' => 'Integer', 'Caption' => 'Paměť', 'Default' => '0', 'Suffix' => 'GB'),
     
    385386    $Desc->AddInteger('InternetSpeedMax');
    386387    $Desc->AddInteger('InternetSpeedMin');
     388    $Desc->AddInteger('InternetSpeedBonus');
    387389    $Desc->AddInteger('InternetUploadAsymmetry');
    388390    $Desc->AddInteger('Memory');
  • trunk/Modules/NetworkConfigRouterOS/Generators/Queue.php

    r929 r970  
    33class SpeedLimit
    44{
    5   var $Min;
    6   var $Max;
    7   var $PacketMark;
     5  public int $Min;
     6  public int $Max;
     7  public ?int $PacketMark;
    88
    99  function __construct(int $Min, int $Max, int $PacketMark = null)
     
    2525class SpeedLimitItem
    2626{
    27   var $Name;
    28   var $Parent;
    29   var $LimitIn;
    30   var $LimitOut;
    31   var $FixedSpeed;
    32   var $SubItems;
     27  public string $Name;
     28  public ?SpeedLimitItem $Parent;
     29  public SpeedLimit $LimitIn;
     30  public SpeedLimit $LimitOut;
     31  public bool $FixedSpeed;
     32  public SpeedLimitItems $SubItems;
    3333
    3434  function __construct(string $Name, SpeedLimitItem $Parent = null)
     
    184184    $UsersMaxSpeedIn = round($Finance->MaxSpeed / $InDivider) * 1000;
    185185    $UsersMaxSpeedOut = round($Finance->MaxSpeed / $OutDivider) * 1000;
    186     $VoipMaxSpeedIn = $TotalMaxSpeedIn - 136;
    187     $VoipMaxSpeedOut = $TotalMaxSpeedOut - 136;
    188     $VoipSpeedIn = 100; //$SpeedReserve;
    189     $VoipSpeedOut = 100; //$SpeedReserve;
    190186    $OutInterface = 'eth1';
    191187    $InInterface = 'ifb0';
     
    206202    $this->LoadSpeedLimits($Main);
    207203
    208     // Slow free internet
     204    // Free internet
    209205    $Free = new SpeedLimitItem('free', $Main);
    210206    $Free->LimitIn = new SpeedLimit($FreeInetSpeed, $FreeInetSpeed, GetMarkByComment('free-in'));
     
    226222      while ($Service = $DbResult4->fetch_assoc())
    227223      {
     224        $MinSpeed = $Service['InternetSpeedMin'];
     225        $MaxSpeed = $Service['InternetSpeedMax'];
     226        if ($Service['InternetSpeedBonus'] > $MaxSpeed) $MaxSpeed = $Service['InternetSpeedBonus'];
     227
    228228        echo('Služba '.$Service['Name'].': ');
    229229        $MemberName = RouterOSIdent($Member['Name'].'-'.$Member['Id'].'-'.$ServiceIndex);
    230         $SpeedIn = round($Service['InternetSpeedMin'] / $InDivider);
    231         $SpeedOut = round($Service['InternetSpeedMin'] / $OutDivider);
    232         $UserMaxSpeedIn = round($Service['InternetSpeedMax'] / $InDivider);
    233         $UserMaxSpeedOut = round($Service['InternetSpeedMax'] / $OutDivider);
     230        $MinReduction = 100;
     231        $SpeedIn = round($MinSpeed / $InDivider / $MinReduction);
     232        $SpeedOut = round($MinSpeed / $OutDivider / $MinReduction);
     233        $UserMaxSpeedIn = round($MaxSpeed / $InDivider);
     234        $UserMaxSpeedOut = round($MaxSpeed / $OutDivider);
    234235
    235236        // Reduce max speed by speed limits
     
    302303    echo($Main->Print());
    303304    $ItemsQueue = $Main->GetCommands();
    304     $Routerboard->ListUpdate($PathQueue, array('name', 'limit-at', 'max-limit', 'parent', 'packet-mark'), $ItemsQueue, array(), true);
     305    //$Routerboard->ListUpdate($PathQueue, array('name', 'limit-at', 'max-limit', 'parent', 'packet-mark'), $ItemsQueue, array(), true);
    305306  }
    306307
     
    415416    while (count($DevicesToCheck) > 0)
    416417    {
    417       //echo('Pass'."\n");
    418418      $NewDevicesToCheck = array();
    419419      foreach ($DevicesToCheck as $DeviceId)
    420420      {
    421         //echo($this->Devices[$DeviceId]['Name'].': ');
    422421        foreach ($this->Devices[$DeviceId]['Interfaces'] as $InterfaceId)
    423422        {
     
    435434              if ($NewMaxSpeed > $Link['MaxRealSpeed'])
    436435                $NewMaxSpeed = $Link['MaxRealSpeed'];
    437               //echo($this->Devices[$Device2Id]['Name'].' '.$Device2Id.', ');
    438436              $this->Devices[$Device2Id]['MaxSpeed'] = $NewMaxSpeed;
    439437              // Set nodes tree relation
    440438              $this->Devices[$Device2Id]['Parent'] = $DeviceId;
    441439              $this->Devices[$DeviceId]['Childs'][] = $Device2Id;
    442               //echo($NewMaxSpeed.", ".count($NewDevicesToCheck).' ');
    443440              $NewDevicesToCheck[] = $Device2Id;
    444441            }
    445442          }
    446443        }
    447         //echo("\n");
    448444      }
    449445      $DevicesToCheck = $NewDevicesToCheck;
     
    515511    $InDivider = 1;
    516512    $OutDivider = 1;
    517     $TotalMaxSpeedIn = round($Finance->RealMaxSpeed / $InDivider) * 1000;
    518     $TotalMaxSpeedOut = round($Finance->RealMaxSpeed / $OutDivider) * 1000;
    519513    $UsersMaxSpeedIn = round($Finance->MaxSpeed / $InDivider) * 1000;
    520514    $UsersMaxSpeedOut = round($Finance->MaxSpeed / $OutDivider) * 1000;
    521     $VoipMaxSpeedIn = $TotalMaxSpeedIn - 136;
    522     $VoipMaxSpeedOut = $TotalMaxSpeedOut - 136;
    523     $VoipSpeedIn = 100; //$SpeedReserve;
    524     $VoipSpeedOut = 100; //$SpeedReserve;
    525     $OutInterface = 'eth1';
    526     $InInterface = 'ifb0';
    527     $InetInterface = $this->System->Config['MainRouter']['InetInterface'];
    528515
    529516    $DbResult = $this->Database->select('Service', '*', '(`ChangeAction` IS NULL) AND (`Id`='.TARIFF_FREE.')');
  • trunk/Packages/Common/Page.php

    r912 r970  
    77  public string $ParentClass;
    88  public bool $RawPage;
     9  public bool $BasicHTML;
    910  public $OnSystemMessage;
    1011  public string $Load;
     
    1516    parent::__construct($System);
    1617    $this->RawPage = false;
     18    $this->BasicHTML = false;
    1719    $this->OnSystemMessage = array();
    1820    $this->Title = "";
  • trunk/Packages/Common/UTF8.php

    r946 r970  
    3333class Encoding
    3434{
     35  public array $CharTable;
     36 
    3537  function __construct()
    3638  {
Note: See TracChangeset for help on using the changeset viewer.