Changeset 887 for trunk/Modules/NetworkConfigRouterOS/Generators
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- Location:
- trunk/Modules/NetworkConfigRouterOS/Generators
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfigRouterOS/Generators/DHCP.php
r873 r887 4 4 class ConfigRouterOSDHCP extends NetworkConfigItem 5 5 { 6 function Run() 6 function Run(): void 7 7 { 8 8 $Path = array('ip', 'dhcp-server', 'lease'); -
trunk/Modules/NetworkConfigRouterOS/Generators/DNS.php
r873 r887 3 3 class ConfigRouterOSDNS extends NetworkConfigItem 4 4 { 5 function Run() 5 function Run(): void 6 6 { 7 7 $Path = array('ip', 'dns', 'static'); -
trunk/Modules/NetworkConfigRouterOS/Generators/FirewallFilter.php
r873 r887 3 3 class ConfigRouterOSFirewallFilter extends NetworkConfigItem 4 4 { 5 function Run() 5 function Run(): void 6 6 { 7 7 $Path = array('ip', 'firewall', 'filter'); -
trunk/Modules/NetworkConfigRouterOS/Generators/FirewallMangle.php
r873 r887 3 3 class ConfigRouterOSFirewallMangle extends NetworkConfigItem 4 4 { 5 function ProcessNode($Node) 5 function ProcessNode($Node): void 6 6 { 7 7 global $InetInterface, $ItemsFirewall; 8 8 9 foreach ($Node['Items'] as $I ndex => $Item)9 foreach ($Node['Items'] as $Item) 10 10 { 11 11 if (count($Item['Items']) == 0) … … 47 47 } 48 48 49 function Run() 49 function Run(): void 50 50 { 51 51 $this->RunIPv4(); … … 53 53 } 54 54 55 function RunIPv4() 55 function RunIPv4(): void 56 56 { 57 57 global $ItemsFirewall; … … 149 149 } 150 150 151 function RunIPv6() 151 function RunIPv6(): void 152 152 { 153 153 global $ItemsFirewall; -
trunk/Modules/NetworkConfigRouterOS/Generators/FirewallNAT.php
r873 r887 3 3 class ConfigRouterOSFirewallNAT extends NetworkConfigItem 4 4 { 5 function Run() 5 function Run(): void 6 6 { 7 7 $Path = array('ip', 'firewall', 'nat'); -
trunk/Modules/NetworkConfigRouterOS/Generators/Netwatch.php
r873 r887 3 3 class ConfigRouterOSNetwatch extends NetworkConfigItem 4 4 { 5 function Run() 5 function Run(): void 6 6 { 7 7 $Path = array('tool', 'netwatch'); -
trunk/Modules/NetworkConfigRouterOS/Generators/NetwatchImport.php
r873 r887 3 3 class ConfigRouterOSNetwatchImport extends NetworkConfigItem 4 4 { 5 function NetwatchImport() 5 function NetwatchImport(): void 6 6 { 7 7 $StartTime = time(); … … 44 44 $Queries = array(); 45 45 $QueriesInsert = array(); 46 foreach ($Interfaces as $In dex => $Interface)46 foreach ($Interfaces as $Interface) 47 47 { 48 48 // Update last online time if still online … … 103 103 } 104 104 105 function Run() 105 function Run(): void 106 106 { 107 107 RepeatFunction(10, array($this, 'NetwatchImport')); -
trunk/Modules/NetworkConfigRouterOS/Generators/Queue.php
r873 r887 14 14 } 15 15 16 function Print() 16 function Print(): string 17 17 { 18 18 $Output = '(Min: '.$this->Min.' Max: '.$this->Max; … … 46 46 } 47 47 48 function CheckName($Name, &$UsedNames) 48 function CheckName($Name, &$UsedNames): void 49 49 { 50 50 if (in_array($Name, $UsedNames)) die("\n".'Duplicate name: '.$Name); … … 52 52 } 53 53 54 function GetCommands(&$UsedNames = null) 54 function GetCommands(&$UsedNames = null): array 55 55 { 56 56 if ($UsedNames == null) $UsedNames = array(); … … 72 72 } 73 73 74 function GetParentName(string $Suffix) 74 function GetParentName(string $Suffix): string 75 75 { 76 76 if ($this->Parent != null) return $this->Parent->Name.$Suffix; … … 78 78 } 79 79 80 function UpdateMinSpeeds() 80 function UpdateMinSpeeds(): void 81 81 { 82 82 if (($this->LimitIn->Min == 0) or ($this->LimitOut->Min == 0)) … … 100 100 class SpeedLimitItems extends GenericList 101 101 { 102 function AddNew(string $Name, SpeedLimitItem $Parent = null) 102 function AddNew(string $Name, SpeedLimitItem $Parent = null): SpeedLimitItem 103 103 { 104 104 $Item = new SpeedLimitItem($Name, $Parent); 105 $Item->LimitIn = new SpeedLimit( );106 $Item->LimitOut = new SpeedLimit( );105 $Item->LimitIn = new SpeedLimit(0, 0); 106 $Item->LimitOut = new SpeedLimit(0, 0); 107 107 $this->Items[] = $Item; 108 108 return $Item; … … 119 119 } 120 120 121 function GetCommands(&$UsedNames) 121 function GetCommands(&$UsedNames): array 122 122 { 123 123 $Output = array(); … … 137 137 var $SpeedLimits; 138 138 139 function Run() 139 function Run(): void 140 140 { 141 141 $PathQueue = array('queue', 'tree'); … … 149 149 $this->UsedNames = array(); 150 150 151 $Finance = & $this->System->Modules['Finance'];151 $Finance = &ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance; 152 152 $Finance->LoadMonthParameters(0); 153 153 … … 280 280 } 281 281 282 function BuildSpeedLimit(&$SpeedLimit, $TopSpeedLimitItem) 282 function BuildSpeedLimit(&$SpeedLimit, $TopSpeedLimitItem): void 283 283 { 284 284 $SpeedLimitName = $SpeedLimit['Name'].'-grp'; … … 297 297 } 298 298 299 function LoadSpeedLimits($SpeedLimitItem) 299 function LoadSpeedLimits($SpeedLimitItem): void 300 300 { 301 301 echo('Limit groups: '); … … 326 326 } 327 327 328 function UpdateMinSpeed($DeviceId) 328 function UpdateMinSpeed($DeviceId): void 329 329 { 330 330 $MinSpeed = 0; … … 340 340 341 341 // Calculate maximum real speed available for each network device Start with main router and continue with adjecement nodes. 342 function BuildTree($RootDeviceId, $BaseSpeed) 342 function BuildTree($RootDeviceId, $BaseSpeed): void 343 343 { 344 344 // Load network devices … … 438 438 } 439 439 440 function BuildQueueItems($DeviceId, $SpeedLimitParent) 440 function BuildQueueItems($DeviceId, $SpeedLimitParent): void 441 441 { 442 442 $Device = $this->Devices[$DeviceId]; … … 475 475 } 476 476 477 function RunTopology() 477 function RunTopology(): void 478 478 { 479 479 $PathQueue = array('queue', 'tree'); … … 487 487 $this->UsedNames = array(); 488 488 489 $Finance = & $this->System->Modules['Finance'];489 $Finance = &ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance; 490 490 $Finance->LoadMonthParameters(0); 491 491 -
trunk/Modules/NetworkConfigRouterOS/Generators/Signal.php
r874 r887 3 3 class ConfigRouterOSSignal extends NetworkConfigItem 4 4 { 5 function ReadWirelessRegistration() 5 function ReadWirelessRegistration(): void 6 6 { 7 7 $Time = time(); … … 66 66 $this->Database->Transaction($Queries); 67 67 } 68 69 function StripUnits($Value) 68 69 function StripUnits($Value): string 70 70 { 71 71 if (strpos($Value, '-') !== false) $Value = substr($Value, 0, strpos($Value, '-') - 1); // without channel info 72 72 if (substr($Value, -3, 3) == "MHz") $Value = substr($Value, 0, -3); // without MHz unit 73 if (substr($Value, -4, 4) == "Mbps") $Value = substr($Value, 0, -4); // without Mbps unit 74 if (substr($Value, -3, 3) == "Mbp") $Value = substr($Value, 0, -3); // without Mbp unit 73 if (substr($Value, -4, 4) == "Mbps") $Value = substr($Value, 0, -4); // without Mbps unit 74 if (substr($Value, -3, 3) == "Mbp") $Value = substr($Value, 0, -3); // without Mbp unit 75 75 if (substr($Value, -1, 1) == "M") $Value = substr($Value, 0, -1); // without M unit 76 76 return $Value; 77 77 } 78 78 79 function Run() 79 function Run(): void 80 80 { 81 81 RepeatFunction(60 * 60, array($this, 'ReadWirelessRegistration'));
Note:
See TracChangeset
for help on using the changeset viewer.