From 0f4eca55b67c38cc38f694ad1bb5d7d8b867340c Mon Sep 17 00:00:00 2001 From: Patrik Majer Date: Sun, 29 Jun 2025 08:32:52 +0200 Subject: [PATCH 1/4] adminator: remove dead/unused code (routerOS, mk_control) --- adminator2/category.php | 36 - adminator2/composer.json | 3 +- adminator2/mk_control/mk_qos_handler.php | 125 -- adminator2/mk_control/mk_rh_restriction.php | 92 -- .../stable/2011-03-08/mk_qos_handler.php | 101 -- .../stable/2011-03-08/ros_api_simelon.php | 885 ------------- .../stable/2011-03-28/mk_qos_handler.php | 101 -- .../stable/2011-03-28/mk_rh_restriction.php | 66 - .../stable/2011-03-28/ros_api_restriction.php | 303 ----- .../stable/2011-03-28/ros_api_simelon.php | 1072 --------------- .../stable/2011-04-18/mk_qos_handler.php | 103 -- .../stable/2011-04-18/mk_rh_restriction.php | 66 - .../stable/2011-04-18/ros_api_restriction.php | 303 ----- .../stable/2011-04-18/ros_api_simelon.php | 1157 ----------------- .../mk_qos_handler.php | 101 -- .../mk_qos_handler_test.php | 101 -- .../ros_api_simelon.php | 885 ------------- .../ros_api_simelon_test.php | 1044 --------------- .../testing/2011-03-11/mk_qos_handler.php | 101 -- .../2011-03-11/mk_qos_handler_test.php | 101 -- .../testing/2011-03-11/ros_api_simelon.php | 885 ------------- .../2011-03-11/ros_api_simelon_test.php | 1065 --------------- .../mk_qos_handler_test.php | 101 -- .../ros_api_simelon_test.php | 1072 --------------- .../mk_qos_handler_test.php | 102 -- .../ros_api_simelon_test.php | 1155 ---------------- adminator2/platby-vypis.php | 14 +- adminator3/composer.json | 1 - adminator3/composer.lock | 243 +--- adminator3/tests/adminator/Work/WorkTest.php | 2 +- 30 files changed, 51 insertions(+), 11335 deletions(-) delete mode 100644 adminator2/mk_control/mk_qos_handler.php delete mode 100644 adminator2/mk_control/mk_rh_restriction.php delete mode 100644 adminator2/mk_control/stable/2011-03-08/mk_qos_handler.php delete mode 100644 adminator2/mk_control/stable/2011-03-08/ros_api_simelon.php delete mode 100644 adminator2/mk_control/stable/2011-03-28/mk_qos_handler.php delete mode 100644 adminator2/mk_control/stable/2011-03-28/mk_rh_restriction.php delete mode 100644 adminator2/mk_control/stable/2011-03-28/ros_api_restriction.php delete mode 100644 adminator2/mk_control/stable/2011-03-28/ros_api_simelon.php delete mode 100644 adminator2/mk_control/stable/2011-04-18/mk_qos_handler.php delete mode 100644 adminator2/mk_control/stable/2011-04-18/mk_rh_restriction.php delete mode 100644 adminator2/mk_control/stable/2011-04-18/ros_api_restriction.php delete mode 100644 adminator2/mk_control/stable/2011-04-18/ros_api_simelon.php delete mode 100644 adminator2/mk_control/testing/2011-03-10-garants-lines&routers/mk_qos_handler.php delete mode 100644 adminator2/mk_control/testing/2011-03-10-garants-lines&routers/mk_qos_handler_test.php delete mode 100644 adminator2/mk_control/testing/2011-03-10-garants-lines&routers/ros_api_simelon.php delete mode 100644 adminator2/mk_control/testing/2011-03-10-garants-lines&routers/ros_api_simelon_test.php delete mode 100644 adminator2/mk_control/testing/2011-03-11/mk_qos_handler.php delete mode 100644 adminator2/mk_control/testing/2011-03-11/mk_qos_handler_test.php delete mode 100644 adminator2/mk_control/testing/2011-03-11/ros_api_simelon.php delete mode 100644 adminator2/mk_control/testing/2011-03-11/ros_api_simelon_test.php delete mode 100644 adminator2/mk_control/testing/2011-03-15-plus-client-ap-ip/mk_qos_handler_test.php delete mode 100644 adminator2/mk_control/testing/2011-03-15-plus-client-ap-ip/ros_api_simelon_test.php delete mode 100644 adminator2/mk_control/testing/2011-03-29--diff-QT/mk_qos_handler_test.php delete mode 100644 adminator2/mk_control/testing/2011-03-29--diff-QT/ros_api_simelon_test.php diff --git a/adminator2/category.php b/adminator2/category.php index d7ceda351..c56d00800 100644 --- a/adminator2/category.php +++ b/adminator2/category.php @@ -132,45 +132,9 @@ { echo "jméno: ".$data_user_nick["email"].", level: ".$data_user_nick["level"]."
"; } } // konec else - // ted najilejeme prihlaseny lidi ( vsecky ) do pop-up okna - // $MSQ_USER2 = $conn_mysql->query("SELECT nick, level FROM autorizace"); - - // $MSQ_USER_COUNT=$MSQ_USER2->num_rows; - - // if ( $MSQ_USER_COUNT < 1 ){ $obsah_pop_okna .= "Nikdo nepřihlášen. (divny)"; } - // else - // { - - // while ($data_user2 = $MSQ_USER2->fetch_array()) - // { - // $obsah_pop_okna .= "jméno: ".$data_user2["nick"].", level: ".$data_user2["level"].", "; - // } //konec while - - // } // konec if - echo "
Odhlásit se
"; - // echo ""; - - // require("include/js.include.1.php"); - - // $windowtext2 = "Ostatní přihlášení uživatelé: ".'\n'.$obsah_pop_okna; - // $windowtext2 = $obsah_pop_okna; - - // // velikost okna - // $windowdelka2 = 170; - // $windowpadding2 = 40; - - // // pozice okna - // $windowtop2 = 150; - // $windowleft2 = 350; - - // include("include/window-main2.php"); - - // echo '
'; - ?> diff --git a/adminator2/composer.json b/adminator2/composer.json index 9aaea7045..8a771a165 100644 --- a/adminator2/composer.json +++ b/adminator2/composer.json @@ -17,8 +17,7 @@ "nyholm/psr7-server": "^1.0.2", "symfony/http-foundation": "^v6.4", "odan/session": "^6.1", - "phpmailer/phpmailer": "^6.9.1", - "evilfreelancer/routeros-api-php": "1.5.2" + "phpmailer/phpmailer": "^6.9.1" }, "require-dev": { "phpunit/phpunit": "^9.0", diff --git a/adminator2/mk_control/mk_qos_handler.php b/adminator2/mk_control/mk_qos_handler.php deleted file mode 100644 index d7ac41ff3..000000000 --- a/adminator2/mk_control/mk_qos_handler.php +++ /dev/null @@ -1,125 +0,0 @@ -\n"; - -use RouterOS\Config; -use RouterOS\Client; -use RouterOS\Query; - -// -//input variables -// - -$debug = 0; - -//login vars -$login_user = "admin"; -$login_pass = ""; - -//api vars -$element_name_dwn = "dst-address"; -$element_name_upl = "src-address"; -$item_ip_dwn = "dst-address"; -$item_ip_upl = "src-address"; - -$chain = "forward"; - -$sc_speed_koef = 1.1; - -//ip adress device -if( isset($_GET["ip"]) ) -{ $ip = $_GET["ip"]; } -elseif( isset($_SERVER['argv']['1']) ) -{ $ip = $_SERVER['argv']['1']; } -else -{ - echo "ERROR: Missing IP Adress. Aborting... \n"; - exit; -} - -if(!( preg_match("/^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])" . - "(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$/", $ip)) ) -{ - echo "ERROR: IP address is not valid. Aborting... \n"; - exit; -} - -// $conn = RouterOS::connect($ip, $login_user, $login_pass) or die("couldn't connect to router\n"); - -$rosConfig = new Config([ - 'host' => $ip, - 'user' => $login_user, - 'pass' => $login_pass, - 'port' => 18728, -]); - -try { - $rosClient = new Client($rosConfig); - echo "mk_qos_handler.php: Connection to router was established.
\n"; -} catch (Exception $exception) { - echo "mk_qos_handler.php: Error! Couldn't connect to router!\n" . $exception->getMessage() . "
\n"; - exit(1); -} - -$mk_qos=new mk_synchro_qos($conn_mysql, $rosClient); - -$mk_qos->debug = $debug; - -$mk_qos->find_version(); - -$rs = $mk_qos->set_wanted_values($ip); //nastaveni IP a ID routeru do globalnich promennych -if( $rs === false ) { - echo "mk_qos_handler.php: Error! Router not found in database
\n"; - exit(2); -} - -$mk_qos->element_name_dwn=$element_name_dwn; -$mk_qos->element_name_upl=$element_name_upl; - -$mk_qos->item_ip_dwn=$item_ip_dwn; -$mk_qos->item_ip_upl=$item_ip_upl; - -$mk_qos->speed_mp_dwn="10240000"; -$mk_qos->speed_mp_upl="5120000"; - -$mk_qos->chain=$chain; - -$rs = $mk_qos->find_obj($ip); -if( $rs === false ) { - echo "mk_qos_handler.php: ERROR: find_obj failed!
\n"; - exit(3); -} - -//$mk_qos->find_obj("10.128.0.3"); - -$mk_qos->sc_speed_koef=$sc_speed_koef; - - // - //reseni firewall/mangle - // - - $mk_qos->detect_diff_in_mangle(); - - if($mk_qos->force_mangle_rewrite == 1){ - $mk_qos->synchro_mangle_force(); - } - else - { - print " counts excess ip: ".count($mk_qos->arr_global_diff_exc).", missing ip: ".count($mk_qos->arr_global_diff_mis)."\n"; - $mk_qos->synchro_mangle(); - } - - // - // reseni queue(s) - // - - $mk_qos->qt_global(); - - $mk_qos->detect_diff_queues(); - //$mk_qos->synchro_qt_force(); diff --git a/adminator2/mk_control/mk_rh_restriction.php b/adminator2/mk_control/mk_rh_restriction.php deleted file mode 100644 index ff258562d..000000000 --- a/adminator2/mk_control/mk_rh_restriction.php +++ /dev/null @@ -1,92 +0,0 @@ -\n"; - -use RouterOS\Config; -use RouterOS\Client; -use RouterOS\Query; - -// -//input variables -// - -$debug = 0; - -//login vars -$login_user = "admin"; -$login_pass = ""; - -//api vars - -//ip adress device -if( isset($_GET["ip"]) ) -{ $ip = $_GET["ip"]; } -elseif( isset($_SERVER['argv']['1']) ) -{ $ip = $_SERVER['argv']['1']; } -else -{ - echo "ERROR: Missing IP Adress. Aborting... \n"; - exit; -} - -if(!( preg_match("/^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])" . - "(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$/", $ip)) ) -{ - echo "ERROR: IP address is not valid. Aborting... \n"; - exit; -} - -$mk=new mk_net_n_sikana; -$mk->conn_mysql = $conn_mysql; - -$mk->zamek_status(); //pokud ON, tak exit :) - -$mk->zamek_lock(); - -// $conn = RouterOS::connect($ip, $login_user, $login_pass) or die("couldn't connect to router\n"); - -$rosConfig = new Config([ - 'host' => $ip, - 'user' => $login_user, - 'pass' => $login_pass, - 'port' => 18728, -]); - -try { - $rosClient = new Client($rosConfig); - echo "mk_rh_restriction.php: Connection to router was established.
\n"; -} catch (Exception $exception) { - echo "mk_rh_restriction.php: Error! Couldn't connect to router!\n" . $exception->getMessage() . "
\n"; - $mk->zamek_unlock(); - exit(1); -} - -$resourceQuery = (new Query('/system/resource/print')); -$response = $rosClient->query($resourceQuery)->read(); -echo "mk_rh_restriction.php: INFO: version of RouterOS: " . var_export($response[0]['version'], true) . "
\n"; - -$mk->debug = $debug; -$mk->conn = $rosClient; -$mk->rosClient = $rosClient; - -$rs = $mk->find_obj($ip); - -if ($rs === false){ - echo "mk_rh_restriction.php: ERROR: find_obj failed!
\n"; - $mk->zamek_unlock(); - exit; -} - -$mk->detect_diff_and_repaid("net-n"); - -$mk->detect_diff_and_repaid("sikana"); - -$mk->zamek_unlock(); - -echo "mk_rh_restriction.php finish
\n"; diff --git a/adminator2/mk_control/stable/2011-03-08/mk_qos_handler.php b/adminator2/mk_control/stable/2011-03-08/mk_qos_handler.php deleted file mode 100644 index 88203c6da..000000000 --- a/adminator2/mk_control/stable/2011-03-08/mk_qos_handler.php +++ /dev/null @@ -1,101 +0,0 @@ -debug=$debug; -$mk_qos->conn=$conn; - -$mk_qos->element_name_dwn=$element_name_dwn; -$mk_qos->element_name_upl=$element_name_upl; - -$mk_qos->item_ip_dwn=$item_ip_dwn; -$mk_qos->item_ip_upl=$item_ip_upl; - -$mk_qos->chain=$chain; - -$mk_qos->find_obj("10.128.0.3"); - -$mk_qos->sc_speed_koef=$sc_speed_koef; - - // - //reseni firewall/mangle - // - - $mk_qos->detect_diff_in_mangle(); - - if($mk_qos->force_mangle_rewrite == 1){ - $mk_qos->synchro_mangle_force(); - } - else - { - print " counts excess ip: ".count($mk_qos->arr_global_diff_exc).", missing ip: ".count($mk_qos->arr_global_diff_mis)."\n"; - $mk_qos->synchro_mangle(); - } - - // - // reseni queue(s) - // - - - $mk_qos->qt_global(); - - //$mk_qos->detect_diff_queues(); - $mk_qos->synchro_qt_force(); - - -?> diff --git a/adminator2/mk_control/stable/2011-03-08/ros_api_simelon.php b/adminator2/mk_control/stable/2011-03-08/ros_api_simelon.php deleted file mode 100644 index 42a8bb075..000000000 --- a/adminator2/mk_control/stable/2011-03-08/ros_api_simelon.php +++ /dev/null @@ -1,885 +0,0 @@ - $second) - { - foreach ($a1 as $key => $first) - { - - if (isset($a2[$key])) - { - foreach ($first as $first_value) - { - foreach ($second as $second_value) - { - if ($first_value == $second_value) - { - $true = true; - break; - } - } - if (!isset($true)) - { - - $r[$key][] = $first_value; - } - unset($true); - } - } - else - { - $r[$key] = $first; - } - } - } - - return $r; - - } //end of function multidimensional array diff - - function find_root_router($id_routeru, $ip_adresa_routeru) - { - $rs = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$id_routeru'"); - - while( $d = mysql_fetch_array($rs) ) - { $parent_router = $d["parent_router"]; } - - $rs2 = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$parent_router'"); - - while( $d2 = mysql_fetch_array($rs2) ) - { $ip_adresa_2 = $d2["ip_adresa"]; } - - if($ip_adresa_2 == $ip_adresa_routeru) - { //dosahlo se reinhard-fiber, tj. zaznam CHCEME - return true; - } - elseif($parent_router == "0") - { //dosahlo se reinhard-wifi, takze zaznam nechceme - } - else - { //ani jedno predchozi, rekurze .. :) - if( $this->find_root_router($parent_router, $ip_adresa_routeru) == true) - { return true; } - } - - } //end of function find_root_router - - function find_obj($ip) - { - - //1. zjistit routery co jedou pres reinhard-fiber - $rs_routers = $conn_mysql->query("SELECT id, parent_router, nazev FROM router_list ORDER BY id"); - $num_rs_routers = mysql_num_rows($rs_routers); - - while($data_routers = mysql_fetch_array($rs_routers)) - { - $id_routeru = $data_routers["id"]; - if( $this->find_root_router($id_routeru,$ip) === true) - { $routers[] = $id_routeru; } - } - - //2. zjistit nody - $i=0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if($i == 0) - { $sql_where .= "'$id_routeru'"; } - else - { $sql_where .= ",'$id_routeru'"; } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - //print $sql."\n"; - - $rs_nods = $conn_mysql->query($sql); - $num_rs_nods = mysql_num_rows($rs_nods); - - while($data_nods = mysql_fetch_array($rs_nods)) - { $nods[] = $data_nods["id"]; } - - //3. zjistit lidi - $i=0; - - foreach ($nods as $key => $id_nodu ){ - //print "nods: ".$id_nodu." \n"; - - if($i == 0) - { $sql_obj_where .= "'$id_nodu'"; } - else - { $sql_obj_where .= ",'$id_nodu'"; } - - $i++; - } - - $sql_obj = "SELECT ip, id_tarifu, dns_jmeno FROM objekty WHERE id_nodu IN (".$sql_obj_where.") ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $rs_objects = pg_query($sql_obj); - $num_rs_objects = pg_num_rows($rs_objects); - - while( $data = pg_fetch_array($rs_objects)) - { - $ip = $data["ip"]; - $this->objects[$ip] = $data["id_tarifu"]; - } - - print " number of IP addresses via this router: ".$num_rs_objects; - if($this->debug == 1){ echo ", count of array objects: ".count($this->objects)." "; } - echo "\n"; - - } //end of function - - function remove_wrong_items($wrong_items) - { - $item_del_ok=0; - $item_del_err=0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/mangle", $wrong_items); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; } - $item_del_ok = count($wrong_items); - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - function detect_diff_in_mangle() - { - - $this->getall_mangle = $this->conn->getall(array("ip", "firewall", "mangle") ); - -/* - if( count($this->getall_mangle) > 0 ) { - print_r($this->getall_mangle); } - else { - echo " Array \"getall_mangle\" is empty \n"; } -*/ - - //priprava zaznamu v routeru - foreach ($this->getall_mangle as $key => $value) { - - $ip_dwn = $this->getall_mangle["$key"]["$this->element_name_dwn"]; - $ip_upl = $this->getall_mangle["$key"]["$this->element_name_upl"]; - - if( isset($this->getall_mangle[$key]["$this->element_name_dwn"]) ) - { - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_dwn"]."_dwn"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_dwn"] = $this->getall_mangle[$key]["$this->element_name_dwn"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $arr_objects_dev_dwn[$ip_dwn] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - - //echo "adding: $ip -- $key\n"; - } - elseif( isset($this->getall_mangle[$key]["$this->element_name_upl"]) ) - { - - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_upl"]."_upl"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_upl"] = $this->getall_mangle[$key]["$this->element_name_upl"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $arr_objects_dev_upl[$ip_upl] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - } - else - { - echo " WARNING: Nalezeno jiné pravidlo/nelze parsovat. (id: ".$this->getall_mangle["$key"][".id"].") \n"; - - //zde udelat seznam pravidel pro smazani :) - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - - } //end of else if - } - - if( (count($this->wrong_firewall_items) > 0 ) && ($this->force_mangle_rewrite != 1)) - { $this->remove_wrong_items($this->wrong_firewall_items); } - - //print_r($arr_objects_dev_dwn); - //print_r($arr_objects_dev_upl); - if( !(is_array($arr_objects_dev_upl)) ) - { $arr_objects_dev_upl = array(); } - - if( !(is_array($arr_objects_dev_dwn)) ) - { $arr_objects_dev_dwn = array(); } - - $arr_obj_dev_diff = array_diff_key($arr_objects_dev_dwn, $arr_objects_dev_upl); - //print_r($arr_obj_dev_diff); - - $arr_obj_dev_diff2 = array_diff_key($arr_objects_dev_upl, $arr_objects_dev_dwn); - //print_r($arr_obj_dev_diff2); - - if( (count($arr_obj_dev_diff) > 0) or ( count($arr_obj_dev_diff2) > 0) ) - { - echo " ERROR: Rozdilny pocet zaznamu pro DWN a UPL. Forcing a full sync... \n"; - $this->force_mangle_rewrite = 1; - } - else - { - echo " number of records : device: ".count($arr_objects_dev_dwn).", system: ".count($this->objects)."\n"; - - $this->arr_global_diff_exc = array_diff_key($arr_objects_dev_dwn, $this->objects); - $this->arr_global_diff_mis = array_diff_key($this->objects, $arr_objects_dev_dwn); - } - -} //end of function detect_diff_in_mangle - -function erase_mangle(){ - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->getall_mangle as $key => $value) { - - /* - if(asi nejake yjimky) - {} - else - */ - { - $erase[] = $this->getall_mangle[$key][".id"]; - //print "erasing id: ".$key."\n"; - } - - } //end of forearch - - $del = $this->conn->remove("/ip/firewall/mangle", $erase); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Item(s) successfully deleted (".count($erase).")\n"; } - $items_suc_del++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - print " count of force deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - //print_r($erase)."\n"; - -} //end of function erase_mangle - -function synchro_mangle_force() -{ - //reseni asi smazat vse a pak pustit synchro_mangle - $this->erase_mangle(); - - $this->detect_diff_in_mangle(); - - $this->synchro_mangle(); - -} //end of function synchro_mangle_force - -function synchro_mangle() -{ - - $items_suc_added = 0; - $items_err_added = 0; - - foreach ($this->arr_global_diff_mis as $ip => $value) { - - $add_par_r = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_dwn", - "$this->item_ip_dwn" => "$ip", "passthrough" => "no"); - $add = $this->conn->add("/ip/firewall/mangle", $add_par_r); - - if( ereg('^\*([[:xdigit:]])*$',$add) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add)."\n"; } - $items_err_added++; - } - - $add_par_r2 = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_upl", - "$this->item_ip_upl" => "$ip", "passthrough" => "no"); - $add2 = $this->conn->add("/ip/firewall/mangle", $add_par_r2); - - if( ereg('^\*([[:xdigit:]])*$',$add2) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add2)."\n"; } - $items_err_added++; - print_r($add_par_r2); - } - - } //end of foreach $arr_global_diff_mis - - print " count of added items: ok: ".$items_suc_added.", error: ".$items_err_added."\n"; - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->arr_global_diff_exc as $ip => $value) { - - $index = $arr_objects_dev_dwn["$ip"]; - $index2 = $arr_objects_dev_upl["$ip"]; - - //echo " deleted: ".$ip.", v1: $index, v2: $index2 \n"; - - $del = $this->conn->remove("/ip/firewall/mangle", array("$index","$index2") ); - - if( $del == "1" ) - { - if($debug > 0){ echo " Item(s) successfully deleted (".$index.",".$index2.")\n"; } - $items_suc_del++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - } //end of foreach $arr_global_diff_mis - - print " count of deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - -} //end of function synchro_mangle - -function qt_global() { - - //zjisteni agregace SC - $rs_agreg = $conn_mysql->query("SELECT agregace, speed_dwn, speed_upl FROM tarify_int WHERE id_tarifu = '1'"); - - while( $d_agreg = mysql_fetch_array($rs_agreg) ) - { - $this->agregace_sc = $d_agreg["agregace"]; - $this->speed_sc_dwn = $d_agreg["speed_dwn"]; - $this->speed_sc_upl = $d_agreg["speed_upl"]; - } - - foreach ($this->objects as $ip => $linka) { - - if($linka == 1) { - $this->objects_sc[] = $ip; - } elseif($linka == 0) { - $this->objects_mp[] = $ip; - } - - //ehm zde garanti este - - else - { - echo " WARNING: Neznámá linka (".$linka.") u objektu: ".$ip."\n"; - } - } - - echo " qt(global) number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - -} - -function qt_delete_all(){ - - $qt_suc_del=0; - $qt_err_del=0; - - $qt_del_all = $this->conn->getall(array("queue","tree")); - - foreach ($qt_del_all as $key => $value) { - - $qt_del_all_id[] = $qt_del_all[$key][".id"]; - - } - - $qt_del = $this->conn->remove("/queue/tree", $qt_del_all_id ); - - if( $qt_del == "1" ) { - if($this->debug > 0){ echo " QT Item(s) successfully deleted (".count($qt_del_all_id).")\n"; } - $qt_suc_del++; - } - else { - if($this->debug > 0){ echo " QT ERROR: ".print_r($qt_del_all_id)."\n"; } - $qt_err_del++; - } - - print " qt: deleted items ".count($qt_del_all_id).", ok: ".$qt_suc_del.", error: ".$qt_err_del."\n"; - - // print_r($qt_del_all_id); - -} - -function detect_diff_queues() { - - //1. zjistime co je v zarizeni - //$qt_dump = $this->conn->getall( array("queue","tree"), "", "", ".id" ); - $qt_dump = $this->conn->getall( array("queue","tree")); - - // print_r($qt_dump); - $qt_dump_trim = $qt_dump; - - //vymazeme .id, jinak nelze pole porovnat - foreach ($qt_dump_trim as $key => $value) { - - unset($qt_dump_trim["$key"][".id"]); - - } //end of foreach qt_dump_trim - - //2. zjistime, co je v adminatoru - - // - // 2.1 SmallCity Linky - // - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - -/* - //muster - [name] => q-dwn-sc-1 - [parent] => global-out - [limit-at] => 2252800 - [priority] => 1 - [max-limit] => 2252800 - [burst-limit] => 0 - [burst-threshold] => 0 - [burst-time] => 00:00:00 - [invalid] => false - [disabled] => false -*/ - - //2.1.1 - agregacni SC tridy - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false"); - } - - //2.1.2 - jednotlive IP adresy - - $qt_system[] = array ("name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "packet-mark" => $ip."_dwn", - "limit-at" => $limit_at_sc_dwn, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_dwn)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "packet-mark" => $ip."_upl", - "limit-at" => $limit_at_sc_upl, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_upl)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } //end of foreach array objects_sc - - // - // 2.2 - MP linky - // - - // - // 2.3 - Garanti - // - - - // - // 3. porovname pole - // - - print_r($qt_dump_trim); - print_r($qt_system); - -/* - if( (count($qt_dump_trim) != count($qt_system) )) - { - echo " qt - does not match the number of elements - forcing rewrite .."; - - $this->synchro_qt_force(); - } - else - { - echo " qt check excess records -- \n"; - - foreach ($qt_dump_trim as $id => $arr_values) { - - $arr2 = array(0); - $arr2 = $qt_system["$id"]; - - $arr_tmp_exc = array_diff($arr_values, $arr2); - - if( (count($arr_tmp_exc) > 0) ) - { - $arr_qt_dev_exc[] = $id; - print_r($arr_tmp_exc); - } - - } //end of foreach $qt_dump_trim - - echo " qt check missing records -- \n"; - - foreach ($qt_system as $id => $arr_values) { - - $arr_tmp_miss = array_diff($arr_values, $qt_dump_trim["$id"]); - - if( (count($arr_tmp_miss) > 0) ) - { - $arr_qt_dev_miss[] = $id; - print_r($arr_tmp_miss); - } - - - } //end of foreach - - //$arr_qt_dev_exc = $this->multidimensional_array_diff($qt_dump_trim, $qt_system); - - //$arr_qt_dev_exc = array_diff($qt_dump_trim, $qt_system); - //print_r($arr_qt_dev_exc); - - //$arr_qt_dev_miss = $this->multidimensional_array_diff($qt_system, $qt_dump_trim); - - //$arr_qt_dev_miss = array_diff($qt_system, $qt_dump_trim); - //print_r($arr_qt_dev_miss); - - echo " qt: number of records : excess: ".count($arr_qt_dev_exc).", missing: ".count($arr_qt_dev_miss)."\n"; - - } //end of else -*/ - -} //end of function datect_diff_queues - -function synchro_qt_force() -{ - - echo " qt - force rewriting ... \n"; - $this->qt_delete_all(); - - echo " tarif info: SmallCity: agregace: ".$this->agregace_sc.", speed dwn: ".$this->speed_sc_dwn."k, upl: ".$this->speed_sc_upl."k \n"; - - echo " qt number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - $qt_ip_suc_added=0; - $qt_ip_err_added=0; - - //muster queues pro SC - ///queue tree - //add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1024k max-limit=1024k name=\ - // q-dwn-sc-1 parent=global-in priority=1 - - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_items_suc_added=0; - $qt_items_err_added=0; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - - print " add QT Group Sc No. ".$sc_group.", items ok: ".$qt_items_suc_added.", error: ".$qt_items_err_added."\n"; - - } - - // add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=1024k name=\ - // q-dwn-sc-10.2.2.2.2 packet-mark=10.52.5.14_dwn parent=q-dwn-sc-1 priority=1 queue=\ - // wireless-default - - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_dwn, "max-limit" => (($this->speed_sc_dwn)*1000), - "name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_upl, "max-limit" => (($this->speed_sc_upl)*1000), - "name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } - - print " qt: count of added items: ok: ".$qt_ip_suc_added.", error: ".$qt_ip_err_added."\n"; - - // - // MP linky - // - $qt_mp_items_suc_added=0; - $qt_mp_items_err_added=0; - - //globalni tridy pro MP - - $add_qt_mp_global_data = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-dwn-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global = $this->conn->add("/queue/tree", $add_qt_mp_global_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_mp_global_data2 = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-upl-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global2 = $this->conn->add("/queue/tree", $add_qt_mp_global_data2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global2)."\n"; } - $qt_mp_items_err_added++; - } - - foreach ($this->objects_mp as $key => $ip) { - - $add_qt_data_mp = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_mp = $this->conn->add("/queue/tree", $add_qt_data_mp); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_data_mp2 = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_mp2 = $this->conn->add("/queue/tree", $add_qt_data_mp2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp2)."\n"; } - $qt_mp_items_err_added++; - } - - } - - print " qt: number of records with MP: added items: ok: ".$qt_mp_items_suc_added.", error: ".$qt_mp_items_err_added."\n"; - -} //end of function synchro_qt_force - - -} //end of class mk_synchro_qos - - - -?> diff --git a/adminator2/mk_control/stable/2011-03-28/mk_qos_handler.php b/adminator2/mk_control/stable/2011-03-28/mk_qos_handler.php deleted file mode 100644 index 945000a88..000000000 --- a/adminator2/mk_control/stable/2011-03-28/mk_qos_handler.php +++ /dev/null @@ -1,101 +0,0 @@ -debug=$debug; -$mk_qos->conn=$conn; - -$mk_qos->element_name_dwn=$element_name_dwn; -$mk_qos->element_name_upl=$element_name_upl; - -$mk_qos->item_ip_dwn=$item_ip_dwn; -$mk_qos->item_ip_upl=$item_ip_upl; - -$mk_qos->chain=$chain; - -$mk_qos->find_obj("10.128.0.3"); - -$mk_qos->sc_speed_koef=$sc_speed_koef; - - // - //reseni firewall/mangle - // - - $mk_qos->detect_diff_in_mangle(); - - if($mk_qos->force_mangle_rewrite == 1){ - $mk_qos->synchro_mangle_force(); - } - else - { - print " counts excess ip: ".count($mk_qos->arr_global_diff_exc).", missing ip: ".count($mk_qos->arr_global_diff_mis)."\n"; - $mk_qos->synchro_mangle(); - } - - // - // reseni queue(s) - // - - - $mk_qos->qt_global(); - - //$mk_qos->detect_diff_queues(); - $mk_qos->synchro_qt_force(); - - -?> diff --git a/adminator2/mk_control/stable/2011-03-28/mk_rh_restriction.php b/adminator2/mk_control/stable/2011-03-28/mk_rh_restriction.php deleted file mode 100644 index 48e07280c..000000000 --- a/adminator2/mk_control/stable/2011-03-28/mk_rh_restriction.php +++ /dev/null @@ -1,66 +0,0 @@ -zamek_status(); //pokud ON, tak exit :) - -$mk->zamek_lock(); - -$conn = RouterOS::connect($ip, $login_user, $login_pass) or die("couldn't connect to router\n"); - -$mk=new mk_net_n_sikana; - -$mk->debug=$debug; -$mk->conn=$conn; - -$mk->find_obj($ip); - -$mk->detect_diff_and_repaid("net-n"); - -$mk->detect_diff_and_repaid("sikana"); - -$mk->zamek_unlock(); - -echo "mk_rh_restriction.php finish \n"; - -?> diff --git a/adminator2/mk_control/stable/2011-03-28/ros_api_restriction.php b/adminator2/mk_control/stable/2011-03-28/ros_api_restriction.php deleted file mode 100644 index 9fb8d5f42..000000000 --- a/adminator2/mk_control/stable/2011-03-28/ros_api_restriction.php +++ /dev/null @@ -1,303 +0,0 @@ -query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$id_routeru'"); - - while( $d = mysql_fetch_array($rs) ) - { $parent_router = $d["parent_router"]; } - - $rs2 = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$parent_router'"); - - while( $d2 = mysql_fetch_array($rs2) ) - { $ip_adresa_2 = $d2["ip_adresa"]; } - - if($ip_adresa_2 == $ip_adresa_routeru) - { //dosahlo se reinhard-fiber, tj. zaznam CHCEME - return true; - } - elseif($parent_router == "0") - { //dosahlo se reinhard-wifi, takze zaznam nechceme - } - else - { //ani jedno predchozi, rekurze .. :) - if( $this->find_root_router($parent_router, $ip_adresa_routeru) == true) - { return true; } - } - - } //end of function find_root_router - - function find_obj($ip) - { - - //1. zjistit routery co jedou pres reinhard-fiber - $rs_routers = $conn_mysql->query("SELECT id, parent_router, nazev FROM router_list ORDER BY id"); - $num_rs_routers = mysql_num_rows($rs_routers); - - while($data_routers = mysql_fetch_array($rs_routers)) - { - $id_routeru = $data_routers["id"]; - if( $this->find_root_router($id_routeru,$ip) === true) - { $routers[] = $id_routeru; } - } - - //2. zjistit nody - $i=0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if($i == 0) - { $sql_where .= "'$id_routeru'"; } - else - { $sql_where .= ",'$id_routeru'"; } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - //print $sql."\n"; - - $rs_nods = $conn_mysql->query($sql); - $num_rs_nods = mysql_num_rows($rs_nods); - - while($data_nods = mysql_fetch_array($rs_nods)) - { $nods[] = $data_nods["id"]; } - - //3. zjistit lidi - $i=0; - - foreach ($nods as $key => $id_nodu ){ - //print "nods: ".$id_nodu." \n"; - - if($i == 0) - { $sql_obj_where .= "'$id_nodu'"; } - else - { $sql_obj_where .= ",'$id_nodu'"; } - - $i++; - } - - $sql_obj = "SELECT ip, dov_net, sikana_status - FROM objekty - WHERE ( - id_nodu IN (".$sql_obj_where.") - AND - ( - objekty.dov_net = 'n'::bpchar - OR - objekty.sikana_status ~~ '%a%'::text - ) - ) - ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $this->rs_objects = pg_query($sql_obj); - $num_rs_objects = pg_num_rows($this->rs_objects); - - while( $data = pg_fetch_array($this->rs_objects)) - { - - if( $data["dov_net"] == "n") - { $this->objects_net_n[] = $data["ip"]; } - elseif( $data["sikana_status"] == "a" ) - { $this->objects_sikana[] = $data["ip"]; } - else - { echo " ERROR: wrong item selected (IP: ".$data["ip"].") \n"; } - } - - print " number of restricted IP addresses: ".$num_rs_objects; - if($this->debug == 1) - { echo ", array objects counts: ".count($this->objects_net_n)." ".count($this->objects_sikana); } - - echo "\n"; - - } //end of function - - function remove_wrong_items($wrong_items) - { - $item_del_ok=0; - $item_del_err=0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/address-list", $wrong_items); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; } - $item_del_ok = count($wrong_items); - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - function detect_diff_and_repaid($mod) - { - if( !( ($mod == "sikana") or ($mod == "net-n") )) - { - echo "ERROR: wrong mode in function \"detect_diff\" \n"; - exit; - } - - $this->wrong_items = array(); - $this->device_items = array(); - - $this->arr_diff_exc = array(); - $this->arr_diff_mis = array(); - - if($mod == "net-n") - { $system_items = $this->objects_net_n; } - else - { $system_items = $this->objects_sikana; } - - $this->getall = $this->conn->getall(array("ip", "firewall", "address-list") ); - - foreach ($this->getall as $key => $value) { - - if( $this->getall["$key"]["list"] == "$mod") - { - $id = $this->getall["$key"][".id"]; - - if( $this->getall["$key"]["disabled"] == "true" ) - { $this->wrong_items[] = $id; } - else - { $this->device_items[$id] = $this->getall["$key"]["address"]; } - - //print_r($this->getall["$key"]); - } - - } //end of foreach getall - - echo " $mod: number of records : device: ".count($this->device_items).", system: ".count($system_items)."\n"; - - - $this->arr_diff_exc = array_diff($this->device_items, $system_items); - $this->arr_diff_mis = array_diff($system_items, $this->device_items); - - //print_r($this->arr_diff_exc); - //print_r($system_items); - - if( ((count($this->arr_diff_exc) == 0) and (count($this->arr_diff_mis) == 0) and (count($this->wrong_items) == 0) ) ) - { echo " $mod: records OK \n"; } - else - { - foreach($this->arr_diff_exc as $key => $value) - { $this->wrong_items[] = $key; } - - echo " $mod: number of records : excess: ".count($this->wrong_items).", missing: ".count($this->arr_diff_mis)."\n"; - - //print_r($this->wrong_items); - if( (count($this->wrong_items) > 0) ) - { $this->remove_wrong_items($this->wrong_items); } - - if( (count($this->arr_diff_mis) > 0 ) ) - $this->add_items($mod); - } - - -} //end of function detect_diff_records - - function add_items($mod) - { - if( !( ($mod == "sikana") or ($mod == "net-n") )) - { - echo "ERROR: wrong mode in function \"add_items\" \n"; - exit; - } - - $item_err_added=0; - $item_suc_added=0; - - foreach($this->arr_diff_mis as $key => $ip) - { - - $add_data = array ("address" => $ip, "list" => $mod); - $add_item = $this->conn->add("/ip/firewall/address-list", $add_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_item) ) - { - if($this->debug > 0){ echo " Item ".$add_item." successfully added \n"; } - $item_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_item)."\n"; } - $item_err_added++; - } - - - } //end of foreach - - echo " $mod add items ok: ".$item_suc_added.", error: ".$item_err_added."\n"; - - - } //end of function add_items - - function zamek_lock() - { - $rs = $conn_mysql->query("UPDATE workzamek SET zamek = 'ano' WHERE id = 1"); - } - - function zamek_unlock() - { - $rs = $conn_mysql->query("UPDATE workzamek SET zamek = 'ne' WHERE id = 1"); - } - - function zamek_status() - { - $rs = $conn_mysql->query("SELECT zamek FROM workzamek WHERE id = 1"); - - while( $data = mysql_fetch_array($rs) ) - { $zamek_status = $data["zamek"]; } - - if( $zamek_status == "ano" ) - { - print " Nelze provést AKCI, jiz se nejaka provadi (LOCKED). Ukončuji skript. \n"; - exit; - } - - } //end of function zamek_status - -} //end of class mk_synchro_qos - - - -?> diff --git a/adminator2/mk_control/stable/2011-03-28/ros_api_simelon.php b/adminator2/mk_control/stable/2011-03-28/ros_api_simelon.php deleted file mode 100644 index 903d6bd43..000000000 --- a/adminator2/mk_control/stable/2011-03-28/ros_api_simelon.php +++ /dev/null @@ -1,1072 +0,0 @@ -query("SELECT id_tarifu, zkratka_tarifu, speed_dwn, speed_upl - FROM tarify_int - WHERE (typ_tarifu = '0' AND garant = '1') - ORDER BY id_tarifu"); - - while($data = mysql_fetch_array($q)) - { - $id = "objects_g_".$data["id_tarifu"]; - $this->objects_garants[$id] = $data["speed_dwn"].":".$data["speed_upl"]; - } - - } //end of function contsruct - -function array_obj_diff ($array1, $array2) { - - foreach ($array1 as $key => $value) { - $array1[$key] = serialize ($value); - } - - foreach ($array2 as $key => $value) { - $array2[$key] = serialize ($value); - } - - $array_diff = array_diff ($array1, $array2); - - foreach ($array_diff as $key => $value) { - $array_diff[$key] = unserialize ($value); - } - - return $array_diff; -} - -//array_obj_diff ($ao1, $ao2); - - function multidimensional_array_diff($a1,$a2) - { - $r = array(); - - foreach ($a2 as $key => $second) - { - foreach ($a1 as $key => $first) - { - - if (isset($a2[$key])) - { - foreach ($first as $first_value) - { - foreach ($second as $second_value) - { - if ($first_value == $second_value) - { - $true = true; - break; - } - } - if (!isset($true)) - { - - $r[$key][] = $first_value; - } - unset($true); - } - } - else - { - $r[$key] = $first; - } - } - } - - return $r; - - } //end of function multidimensional array diff - - function find_root_router($id_routeru, $ip_adresa_routeru) - { - $rs = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$id_routeru'"); - - while( $d = mysql_fetch_array($rs) ) - { $parent_router = $d["parent_router"]; } - - $rs2 = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$parent_router'"); - - while( $d2 = mysql_fetch_array($rs2) ) - { $ip_adresa_2 = $d2["ip_adresa"]; } - - if($ip_adresa_2 == $ip_adresa_routeru) - { //dosahlo se reinhard-fiber, tj. zaznam CHCEME - return true; - } - elseif($parent_router == "0") - { //dosahlo se reinhard-wifi, takze zaznam nechceme - } - else - { //ani jedno predchozi, rekurze .. :) - if( $this->find_root_router($parent_router, $ip_adresa_routeru) == true) - { return true; } - } - - } //end of function find_root_router - - function find_obj($ip) - { - - //1. zjistit routery co jedou pres reinhard-fiber - $rs_routers = $conn_mysql->query("SELECT id, parent_router, nazev, ip_adresa FROM router_list ORDER BY id"); - $num_rs_routers = mysql_num_rows($rs_routers); - - while($data_routers = mysql_fetch_array($rs_routers)) - { - $id_routeru = $data_routers["id"]; - $ip_adresa = $data_routers["ip_adresa"]; - - if( $this->find_root_router($id_routeru,$ip) === true) - { - $routers[] = $id_routeru; - $routers_ip[] = $ip_adresa; - } - } - - //2. zjistit nody - $i=0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if($i == 0) - { $sql_where .= "'$id_routeru'"; } - else - { $sql_where .= ",'$id_routeru'"; } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - //print $sql."\n"; - - $rs_nods = $conn_mysql->query($sql); - $num_rs_nods = mysql_num_rows($rs_nods); - - while($data_nods = mysql_fetch_array($rs_nods)) - { $nods[] = $data_nods["id"]; } - - //3. zjistit lidi - $i=0; - - foreach($nods as $key => $id_nodu ){ - //print "nods: ".$id_nodu." \n"; - - if($i == 0) - { $sql_obj_where .= "'$id_nodu'"; } - else - { $sql_obj_where .= ",'$id_nodu'"; } - - $i++; - } - - $sql_obj = "SELECT ip, id_tarifu, client_ap_ip FROM objekty WHERE id_nodu IN (".$sql_obj_where.") ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $rs_objects = pg_query($sql_obj); - $num_rs_objects = pg_num_rows($rs_objects); - - while( $data = pg_fetch_array($rs_objects)) - { - $ip = $data["ip"]; - $client_ap_ip = $data["client_ap_ip"]; - - $this->objects[$ip] = $data["id_tarifu"]; - - if( (strlen($client_ap_ip) > 4) ) - { //vyplnena ip adresa apcka - - //zjistit zda-li uz neni - if( !(array_key_exists($client_ap_ip, $this->objects)) ) - { $this->objects[$client_ap_ip] = $this->id_tarifu_routers; } - } - } - - //k seznamu ip adres pridame routery, taky chtej inet :) - foreach($routers_ip as $key => $ip) { - - //zjistit zda uz IP adresa neni v objektu - if( (array_key_exists($ip, $this->objects)) ) - { /* echo " object ".$ip." exists \n"; */ } - else - { $this->objects[$ip] = $this->id_tarifu_routers; } - - } - - print " number of IP addresses via this router: ".count($this->objects); - - if($this->debug == 1){ echo ", count of array objects: ".count($this->objects)." "; } - echo "\n"; - - } //end of function - - function remove_wrong_items($wrong_items) - { - $item_del_ok=0; - $item_del_err=0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/mangle", $wrong_items); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; } - $item_del_ok = count($wrong_items); - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - function detect_diff_in_mangle() - { - - $this->getall_mangle = $this->conn->getall(array("ip", "firewall", "mangle") ); - -/* - if( count($this->getall_mangle) > 0 ) { - print_r($this->getall_mangle); } - else { - echo " Array \"getall_mangle\" is empty \n"; } -*/ - - //priprava zaznamu v routeru - foreach ($this->getall_mangle as $key => $value) { - - $ip_dwn = $this->getall_mangle["$key"]["$this->element_name_dwn"]; - $ip_upl = $this->getall_mangle["$key"]["$this->element_name_upl"]; - - if( isset($this->getall_mangle[$key]["$this->element_name_dwn"]) ) - { - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_dwn"]."_dwn"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_dwn"] = $this->getall_mangle[$key]["$this->element_name_dwn"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $this->arr_objects_dev_dwn[$ip_dwn] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - - //echo "adding: $ip -- $key\n"; - } - elseif( isset($this->getall_mangle[$key]["$this->element_name_upl"]) ) - { - - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_upl"]."_upl"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_upl"] = $this->getall_mangle[$key]["$this->element_name_upl"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $this->arr_objects_dev_upl[$ip_upl] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - } - else - { - echo " WARNING: Nalezeno jiné pravidlo/nelze parsovat. (id: ".$this->getall_mangle["$key"][".id"].") \n"; - - //zde udelat seznam pravidel pro smazani :) - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - - } //end of else if - } - - if( (count($this->wrong_firewall_items) > 0 ) && ($this->force_mangle_rewrite != 1)) - { $this->remove_wrong_items($this->wrong_firewall_items); } - - //print_r($arr_objects_dev_dwn); - //print_r($arr_objects_dev_upl); - if( !(is_array($this->arr_objects_dev_upl)) ) - { $this->arr_objects_dev_upl = array(); } - - if( !(is_array($this->arr_objects_dev_dwn)) ) - { $this->arr_objects_dev_dwn = array(); } - - $arr_obj_dev_diff = array_diff_key($this->arr_objects_dev_dwn, $this->arr_objects_dev_upl); - //print_r($arr_obj_dev_diff); - - $arr_obj_dev_diff2 = array_diff_key($this->arr_objects_dev_upl, $this->arr_objects_dev_dwn); - //print_r($arr_obj_dev_diff2); - - if( (count($arr_obj_dev_diff) > 0) or ( count($arr_obj_dev_diff2) > 0) ) - { - echo " ERROR: Rozdilny pocet zaznamu pro DWN a UPL. Forcing a full sync... \n"; - $this->force_mangle_rewrite = 1; - } - else - { - echo " number of records : device: ".count($this->arr_objects_dev_dwn).", system: ".count($this->objects)."\n"; - - $this->arr_global_diff_exc = array_diff_key($this->arr_objects_dev_dwn, $this->objects); - $this->arr_global_diff_mis = array_diff_key($this->objects, $this->arr_objects_dev_dwn); - } - -} //end of function detect_diff_in_mangle - -function erase_mangle(){ - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->getall_mangle as $key => $value) { - - /* - if(asi nejake yjimky) - {} - else - */ - { - $erase[] = $this->getall_mangle[$key][".id"]; - //print "erasing id: ".$key."\n"; - } - - } //end of forearch - - $del = $this->conn->remove("/ip/firewall/mangle", $erase); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Item(s) successfully deleted (".count($erase).")\n"; } - $items_suc_del++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - print " count of force deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - //print_r($erase)."\n"; - -} //end of function erase_mangle - -function synchro_mangle_force() -{ - //reseni asi smazat vse a pak pustit synchro_mangle - $this->erase_mangle(); - - $this->detect_diff_in_mangle(); - - $this->synchro_mangle(); - -} //end of function synchro_mangle_force - -function synchro_mangle() -{ - - $items_suc_added = 0; - $items_err_added = 0; - - foreach ($this->arr_global_diff_mis as $ip => $value) { - - $add_par_r = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_dwn", - "$this->item_ip_dwn" => "$ip", "passthrough" => "no"); - $add = $this->conn->add("/ip/firewall/mangle", $add_par_r); - - if( ereg('^\*([[:xdigit:]])*$',$add) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add)."\n"; } - $items_err_added++; - } - - $add_par_r2 = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_upl", - "$this->item_ip_upl" => "$ip", "passthrough" => "no"); - $add2 = $this->conn->add("/ip/firewall/mangle", $add_par_r2); - - if( ereg('^\*([[:xdigit:]])*$',$add2) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add2)."\n"; } - $items_err_added++; - print_r($add_par_r2); - } - - } //end of foreach $arr_global_diff_mis - - print " count of added items: ok: ".$items_suc_added.", error: ".$items_err_added."\n"; - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->arr_global_diff_exc as $ip => $value) { - - $index = $this->arr_objects_dev_dwn["$ip"]; - $index2 = $this->arr_objects_dev_upl["$ip"]; - - //echo " deleted: ".$ip.", v1: $index, v2: $index2 \n"; - - $del = $this->conn->remove("/ip/firewall/mangle", array("$index","$index2") ); - - if( $del == "1" ) - { - if($debug > 0){ echo " Item(s) successfully deleted (".$index.",".$index2.")\n"; } - $items_suc_del++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - } //end of foreach $arr_global_diff_mis - - print " count of deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - -} //end of function synchro_mangle - -function qt_global() { - - //zjisteni agregace SC - $rs_agreg = $conn_mysql->query("SELECT agregace, speed_dwn, speed_upl FROM tarify_int WHERE id_tarifu = '1'"); - - while( $d_agreg = mysql_fetch_array($rs_agreg) ) - { - $this->agregace_sc = $d_agreg["agregace"]; - $this->speed_sc_dwn = $d_agreg["speed_dwn"]; - $this->speed_sc_upl = $d_agreg["speed_upl"]; - } - - foreach ($this->objects as $ip => $linka) { - - if($linka == 1) { - $this->objects_sc[] = $ip; - } - elseif($linka == 0) { - $this->objects_mp[] = $ip; - } - else - { - if(array_key_exists("objects_g_".$linka, $this->objects_garants)) { - //echo " WARNING: garant: "."objects_g_".$linka.", ip> $ip \n"; - $this->{"objects_g_".$linka}[] = $ip; - } - else { - //$this->objects_garants[] - echo " WARNING: Neznámá linka (".$linka.") u objektu: ".$ip."\n"; - } - } - } - - //zredukovat pole objects_garants, dle vyuziti - foreach ($this->objects_garants as $key => $value) { - - if( (count($this->{$key}) > 0 )) { - $this->objects_garants_used[$key] = $value; - } - - } - - //print_r($this->objects_g_2); - //print_r($this->objects_garants_used); - - echo " qt(global) number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - -} - -function qt_delete_all() { - - $qt_suc_del=0; - $qt_err_del=0; - - $qt_del_all = $this->conn->getall(array("queue","tree")); - - foreach ($qt_del_all as $key => $value) { - - $qt_del_all_id[] = $qt_del_all[$key][".id"]; - - } - - $qt_del = $this->conn->remove("/queue/tree", $qt_del_all_id ); - - if( $qt_del == "1" ) { - if($this->debug > 0){ echo " QT Item(s) successfully deleted (".count($qt_del_all_id).")\n"; } - $qt_suc_del++; - } - else { - if($this->debug > 0){ echo " QT ERROR: ".print_r($qt_del_all_id)."\n"; } - $qt_err_del++; - } - - print " qt: deleted items ".count($qt_del_all_id).", ok: ".$qt_suc_del.", error: ".$qt_err_del."\n"; - - // print_r($qt_del_all_id); - -} - -function detect_diff_queues() { - - //1. zjistime co je v zarizeni - //$qt_dump = $this->conn->getall( array("queue","tree"), "", "", ".id" ); - $qt_dump = $this->conn->getall( array("queue","tree")); - - // print_r($qt_dump); - $qt_dump_trim = $qt_dump; - - //vymazeme .id, jinak nelze pole porovnat - foreach ($qt_dump_trim as $key => $value) { - - unset($qt_dump_trim["$key"][".id"]); - - } //end of foreach qt_dump_trim - - //2. zjistime, co je v adminatoru - - // - // 2.1 SmallCity Linky - // - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - -/* - //muster - [name] => q-dwn-sc-1 - [parent] => global-out - [limit-at] => 2252800 - [priority] => 1 - [max-limit] => 2252800 - [burst-limit] => 0 - [burst-threshold] => 0 - [burst-time] => 00:00:00 - [invalid] => false - [disabled] => false -*/ - - //2.1.1 - agregacni SC tridy - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false"); - } - - //2.1.2 - jednotlive IP adresy - - $qt_system[] = array ("name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "packet-mark" => $ip."_dwn", - "limit-at" => $limit_at_sc_dwn, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_dwn)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "packet-mark" => $ip."_upl", - "limit-at" => $limit_at_sc_upl, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_upl)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } //end of foreach array objects_sc - - // - // 2.2 - MP linky - // - - // - // 2.3 - Garanti - // - - - // - // 3. porovname pole - // - - print_r($qt_dump_trim); - print_r($qt_system); - -/* - if( (count($qt_dump_trim) != count($qt_system) )) - { - echo " qt - does not match the number of elements - forcing rewrite .."; - - $this->synchro_qt_force(); - } - else - { - echo " qt check excess records -- \n"; - - foreach ($qt_dump_trim as $id => $arr_values) { - - $arr2 = array(0); - $arr2 = $qt_system["$id"]; - - $arr_tmp_exc = array_diff($arr_values, $arr2); - - if( (count($arr_tmp_exc) > 0) ) - { - $arr_qt_dev_exc[] = $id; - print_r($arr_tmp_exc); - } - - } //end of foreach $qt_dump_trim - - echo " qt check missing records -- \n"; - - foreach ($qt_system as $id => $arr_values) { - - $arr_tmp_miss = array_diff($arr_values, $qt_dump_trim["$id"]); - - if( (count($arr_tmp_miss) > 0) ) - { - $arr_qt_dev_miss[] = $id; - print_r($arr_tmp_miss); - } - - - } //end of foreach - - //$arr_qt_dev_exc = $this->multidimensional_array_diff($qt_dump_trim, $qt_system); - - //$arr_qt_dev_exc = array_diff($qt_dump_trim, $qt_system); - //print_r($arr_qt_dev_exc); - - //$arr_qt_dev_miss = $this->multidimensional_array_diff($qt_system, $qt_dump_trim); - - //$arr_qt_dev_miss = array_diff($qt_system, $qt_dump_trim); - //print_r($arr_qt_dev_miss); - - echo " qt: number of records : excess: ".count($arr_qt_dev_exc).", missing: ".count($arr_qt_dev_miss)."\n"; - - } //end of else -*/ - -} //end of function datect_diff_queues - -function synchro_qt_force() -{ - - //for testing, erasing arrays - //$this->objects_sc = array(); - //$this->objects_mp = array(); - - echo " qt - force rewriting ... \n"; - $this->qt_delete_all(); - - echo " tarif info: SmallCity: agregace: ".$this->agregace_sc.", speed dwn: ".$this->speed_sc_dwn."k, upl: ".$this->speed_sc_upl."k \n"; - - echo " qt number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - echo " qt number of records tariff: garants: ".count($this->objects_garants_used)."\n"; - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - $qt_ip_suc_added=0; - $qt_ip_err_added=0; - - //muster queues pro SC - ///queue tree - //add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1024k max-limit=1024k name=\ - // q-dwn-sc-1 parent=global-in priority=1 - - // - // QT - SMallCity - // - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_items_suc_added=0; - $qt_items_err_added=0; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - - print " add QT Group Sc No. ".$sc_group.", items ok: ".$qt_items_suc_added.", error: ".$qt_items_err_added."\n"; - - } - - // add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=1024k name=\ - // q-dwn-sc-10.2.2.2.2 packet-mark=10.52.5.14_dwn parent=q-dwn-sc-1 priority=1 queue=\ - // wireless-default - - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_dwn, "max-limit" => (($this->speed_sc_dwn)*1000), - "name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_upl, "max-limit" => (($this->speed_sc_upl)*1000), - "name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } - - print " qt: count of added items: ok: ".$qt_ip_suc_added.", error: ".$qt_ip_err_added."\n"; - - // - // QT Force - MP linky - // - $qt_mp_items_suc_added=0; - $qt_mp_items_err_added=0; - - //globalni tridy pro MP - - $add_qt_mp_global_data = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-dwn-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global = $this->conn->add("/queue/tree", $add_qt_mp_global_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_mp_global_data2 = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-upl-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global2 = $this->conn->add("/queue/tree", $add_qt_mp_global_data2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global2)."\n"; } - $qt_mp_items_err_added++; - } - - foreach ($this->objects_mp as $key => $ip) { - - $add_qt_data_mp = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_mp = $this->conn->add("/queue/tree", $add_qt_data_mp); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_data_mp2 = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_mp2 = $this->conn->add("/queue/tree", $add_qt_data_mp2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp2)."\n"; } - $qt_mp_items_err_added++; - } - - } - - print " qt: number of records with MP: added items: ok: ".$qt_mp_items_suc_added.", error: ".$qt_mp_items_err_added."\n"; - - // - // QT Force - Garanty - // - $qt_g_items_suc_added = 0; - $qt_g_items_err_added = 0; - - foreach( $this->objects_garants_used as $garant_id => $speeds) - { - list($speed_dwn, $speed_upl) = explode(":",$speeds); - - print " qt-force :: garants :: ".$garant_id.", speed_dwn: ".$speed_dwn.", speed_upl: ".$speed_upl."\n"; - - $add_qt_data_g = array ("disabled" => "false", "limit-at" => $speed_dwn."k", "max-limit" => $speed_dwn."k", - "name" => "q-dwn-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g = $this->conn->add("/queue/tree", $add_qt_data_g); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g) ) - { - if($this->debug > 0){ echo " QT Item (garant parent dwn) ".$add_qt_g." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q)."\n"; } - $qt_g_items_err_added++; - } - - $add_qt_data_g2 = array ("disabled" => "false", "limit-at" => $speed_upl."k", "max-limit" => $speed_upl."k", - "name" => "q-upl-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g2 = $this->conn->add("/queue/tree", $add_qt_data_g2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g2) ) - { - if($this->debug > 0){ echo " QT Item (garant parent upl) ".$add_qt_g2." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q2)."\n"; } - $qt_g_items_err_added++; - } - - foreach( $this->{$garant_id} as $id => $ip) - { - - $add_qt_data_g_dwn = array ("disabled" => "false", "name" => "q-dwn-q-".$ip, "parent" => "q-dwn-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_g_dwn = $this->conn->add("/queue/tree", $add_qt_data_g_dwn); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g_dwn) ) - { - if($this->debug > 0){ echo " QT Item (garant ".$ip." dwn) ".$add_qt_g_dwn." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q_dwn)."\n"; } - $qt_g_items_err_added++; - } - - $add_qt_data_g_upl = array ("disabled" => "false", "name" => "q-upl-q-".$ip, "parent" => "q-upl-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_g_upl = $this->conn->add("/queue/tree", $add_qt_data_g_upl); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g_upl) ) - { - if($this->debug > 0){ echo " QT Item (garant ".$ip." upl) ".$add_qt_g_upl." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q2)."\n"; } - $qt_g_items_err_added++; - } - - - } //end of FOREACH $this->{$garant_id} - - } //end of FOREACH objects_garants_used - - print " qt: number of records with GARANT: added items: ok: ".$qt_g_items_suc_added.", error: ".$qt_g_items_err_added."\n"; - -} //end of function synchro_qt_force - - -} //end of class mk_synchro_qos - - - -?> diff --git a/adminator2/mk_control/stable/2011-04-18/mk_qos_handler.php b/adminator2/mk_control/stable/2011-04-18/mk_qos_handler.php deleted file mode 100644 index 9a3b6a62c..000000000 --- a/adminator2/mk_control/stable/2011-04-18/mk_qos_handler.php +++ /dev/null @@ -1,103 +0,0 @@ -debug=$debug; -$mk_qos->conn=$conn; - -$mk_qos->element_name_dwn=$element_name_dwn; -$mk_qos->element_name_upl=$element_name_upl; - -$mk_qos->item_ip_dwn=$item_ip_dwn; -$mk_qos->item_ip_upl=$item_ip_upl; - -$mk_qos->chain=$chain; - -//$mk_qos->find_obj($ip); -$mk_qos->find_obj("10.128.0.3"); - -$mk_qos->sc_speed_koef=$sc_speed_koef; - - // - //reseni firewall/mangle - // - - $mk_qos->detect_diff_in_mangle(); - - if($mk_qos->force_mangle_rewrite == 1){ - $mk_qos->synchro_mangle_force(); - } - else - { - print " counts excess ip: ".count($mk_qos->arr_global_diff_exc).", missing ip: ".count($mk_qos->arr_global_diff_mis)."\n"; - $mk_qos->synchro_mangle(); - } - - // - // reseni queue(s) - // - - - $mk_qos->qt_global(); - - $mk_qos->detect_diff_queues(); - //$mk_qos->synchro_qt_force(); - - -?> diff --git a/adminator2/mk_control/stable/2011-04-18/mk_rh_restriction.php b/adminator2/mk_control/stable/2011-04-18/mk_rh_restriction.php deleted file mode 100644 index 48e07280c..000000000 --- a/adminator2/mk_control/stable/2011-04-18/mk_rh_restriction.php +++ /dev/null @@ -1,66 +0,0 @@ -zamek_status(); //pokud ON, tak exit :) - -$mk->zamek_lock(); - -$conn = RouterOS::connect($ip, $login_user, $login_pass) or die("couldn't connect to router\n"); - -$mk=new mk_net_n_sikana; - -$mk->debug=$debug; -$mk->conn=$conn; - -$mk->find_obj($ip); - -$mk->detect_diff_and_repaid("net-n"); - -$mk->detect_diff_and_repaid("sikana"); - -$mk->zamek_unlock(); - -echo "mk_rh_restriction.php finish \n"; - -?> diff --git a/adminator2/mk_control/stable/2011-04-18/ros_api_restriction.php b/adminator2/mk_control/stable/2011-04-18/ros_api_restriction.php deleted file mode 100644 index 9fb8d5f42..000000000 --- a/adminator2/mk_control/stable/2011-04-18/ros_api_restriction.php +++ /dev/null @@ -1,303 +0,0 @@ -query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$id_routeru'"); - - while( $d = mysql_fetch_array($rs) ) - { $parent_router = $d["parent_router"]; } - - $rs2 = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$parent_router'"); - - while( $d2 = mysql_fetch_array($rs2) ) - { $ip_adresa_2 = $d2["ip_adresa"]; } - - if($ip_adresa_2 == $ip_adresa_routeru) - { //dosahlo se reinhard-fiber, tj. zaznam CHCEME - return true; - } - elseif($parent_router == "0") - { //dosahlo se reinhard-wifi, takze zaznam nechceme - } - else - { //ani jedno predchozi, rekurze .. :) - if( $this->find_root_router($parent_router, $ip_adresa_routeru) == true) - { return true; } - } - - } //end of function find_root_router - - function find_obj($ip) - { - - //1. zjistit routery co jedou pres reinhard-fiber - $rs_routers = $conn_mysql->query("SELECT id, parent_router, nazev FROM router_list ORDER BY id"); - $num_rs_routers = mysql_num_rows($rs_routers); - - while($data_routers = mysql_fetch_array($rs_routers)) - { - $id_routeru = $data_routers["id"]; - if( $this->find_root_router($id_routeru,$ip) === true) - { $routers[] = $id_routeru; } - } - - //2. zjistit nody - $i=0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if($i == 0) - { $sql_where .= "'$id_routeru'"; } - else - { $sql_where .= ",'$id_routeru'"; } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - //print $sql."\n"; - - $rs_nods = $conn_mysql->query($sql); - $num_rs_nods = mysql_num_rows($rs_nods); - - while($data_nods = mysql_fetch_array($rs_nods)) - { $nods[] = $data_nods["id"]; } - - //3. zjistit lidi - $i=0; - - foreach ($nods as $key => $id_nodu ){ - //print "nods: ".$id_nodu." \n"; - - if($i == 0) - { $sql_obj_where .= "'$id_nodu'"; } - else - { $sql_obj_where .= ",'$id_nodu'"; } - - $i++; - } - - $sql_obj = "SELECT ip, dov_net, sikana_status - FROM objekty - WHERE ( - id_nodu IN (".$sql_obj_where.") - AND - ( - objekty.dov_net = 'n'::bpchar - OR - objekty.sikana_status ~~ '%a%'::text - ) - ) - ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $this->rs_objects = pg_query($sql_obj); - $num_rs_objects = pg_num_rows($this->rs_objects); - - while( $data = pg_fetch_array($this->rs_objects)) - { - - if( $data["dov_net"] == "n") - { $this->objects_net_n[] = $data["ip"]; } - elseif( $data["sikana_status"] == "a" ) - { $this->objects_sikana[] = $data["ip"]; } - else - { echo " ERROR: wrong item selected (IP: ".$data["ip"].") \n"; } - } - - print " number of restricted IP addresses: ".$num_rs_objects; - if($this->debug == 1) - { echo ", array objects counts: ".count($this->objects_net_n)." ".count($this->objects_sikana); } - - echo "\n"; - - } //end of function - - function remove_wrong_items($wrong_items) - { - $item_del_ok=0; - $item_del_err=0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/address-list", $wrong_items); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; } - $item_del_ok = count($wrong_items); - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - function detect_diff_and_repaid($mod) - { - if( !( ($mod == "sikana") or ($mod == "net-n") )) - { - echo "ERROR: wrong mode in function \"detect_diff\" \n"; - exit; - } - - $this->wrong_items = array(); - $this->device_items = array(); - - $this->arr_diff_exc = array(); - $this->arr_diff_mis = array(); - - if($mod == "net-n") - { $system_items = $this->objects_net_n; } - else - { $system_items = $this->objects_sikana; } - - $this->getall = $this->conn->getall(array("ip", "firewall", "address-list") ); - - foreach ($this->getall as $key => $value) { - - if( $this->getall["$key"]["list"] == "$mod") - { - $id = $this->getall["$key"][".id"]; - - if( $this->getall["$key"]["disabled"] == "true" ) - { $this->wrong_items[] = $id; } - else - { $this->device_items[$id] = $this->getall["$key"]["address"]; } - - //print_r($this->getall["$key"]); - } - - } //end of foreach getall - - echo " $mod: number of records : device: ".count($this->device_items).", system: ".count($system_items)."\n"; - - - $this->arr_diff_exc = array_diff($this->device_items, $system_items); - $this->arr_diff_mis = array_diff($system_items, $this->device_items); - - //print_r($this->arr_diff_exc); - //print_r($system_items); - - if( ((count($this->arr_diff_exc) == 0) and (count($this->arr_diff_mis) == 0) and (count($this->wrong_items) == 0) ) ) - { echo " $mod: records OK \n"; } - else - { - foreach($this->arr_diff_exc as $key => $value) - { $this->wrong_items[] = $key; } - - echo " $mod: number of records : excess: ".count($this->wrong_items).", missing: ".count($this->arr_diff_mis)."\n"; - - //print_r($this->wrong_items); - if( (count($this->wrong_items) > 0) ) - { $this->remove_wrong_items($this->wrong_items); } - - if( (count($this->arr_diff_mis) > 0 ) ) - $this->add_items($mod); - } - - -} //end of function detect_diff_records - - function add_items($mod) - { - if( !( ($mod == "sikana") or ($mod == "net-n") )) - { - echo "ERROR: wrong mode in function \"add_items\" \n"; - exit; - } - - $item_err_added=0; - $item_suc_added=0; - - foreach($this->arr_diff_mis as $key => $ip) - { - - $add_data = array ("address" => $ip, "list" => $mod); - $add_item = $this->conn->add("/ip/firewall/address-list", $add_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_item) ) - { - if($this->debug > 0){ echo " Item ".$add_item." successfully added \n"; } - $item_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_item)."\n"; } - $item_err_added++; - } - - - } //end of foreach - - echo " $mod add items ok: ".$item_suc_added.", error: ".$item_err_added."\n"; - - - } //end of function add_items - - function zamek_lock() - { - $rs = $conn_mysql->query("UPDATE workzamek SET zamek = 'ano' WHERE id = 1"); - } - - function zamek_unlock() - { - $rs = $conn_mysql->query("UPDATE workzamek SET zamek = 'ne' WHERE id = 1"); - } - - function zamek_status() - { - $rs = $conn_mysql->query("SELECT zamek FROM workzamek WHERE id = 1"); - - while( $data = mysql_fetch_array($rs) ) - { $zamek_status = $data["zamek"]; } - - if( $zamek_status == "ano" ) - { - print " Nelze provést AKCI, jiz se nejaka provadi (LOCKED). Ukončuji skript. \n"; - exit; - } - - } //end of function zamek_status - -} //end of class mk_synchro_qos - - - -?> diff --git a/adminator2/mk_control/stable/2011-04-18/ros_api_simelon.php b/adminator2/mk_control/stable/2011-04-18/ros_api_simelon.php deleted file mode 100644 index 9665f8985..000000000 --- a/adminator2/mk_control/stable/2011-04-18/ros_api_simelon.php +++ /dev/null @@ -1,1157 +0,0 @@ -query("SELECT id_tarifu, zkratka_tarifu, speed_dwn, speed_upl - FROM tarify_int - WHERE (typ_tarifu = '0' AND garant = '1') - ORDER BY id_tarifu"); - - while($data = mysql_fetch_array($q)) - { - $id = "objects_g_".$data["id_tarifu"]; - $this->objects_garants[$id] = $data["speed_dwn"].":".$data["speed_upl"]; - } - - } //end of function contsruct - - function array_serialize($array) { - - $aReturn = array(); - - foreach ($array as $key => $value) - { - if( isset($value["limit-at"])) - { $value["limit-at"] = floatval($value["limit-at"]); } - - if(isset($value["max-limit"])) - { $value["max-limit"] = floatval($value["max-limit"]); } - - $serValue = serialize($value); - - $aReturn[$key] = $serValue; - } - - return $aReturn; - - } //end of function array_serialize - - - function arrayDiff($aArray1, $aArray2) { - - //priprava promenych - $aReturn = array(); - - $serArray1 = $this->array_serialize($aArray1); - $serArray2 = $this->array_serialize($aArray2); - - $diffArray = array_diff($serArray1,$serArray2); - -// echo "--- serArray1 --- \n".print_r($serArray1); -// echo "--- diffArray --- \n".print_r($diffArray)." \n"; - - foreach($diffArray as $key => $value) - { $aReturn[$key] = ""; } - - return $aReturn; - - } //end of function arrayRecursiveDiff - - function find_root_router($id_routeru, $ip_adresa_routeru) - { - $rs = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$id_routeru'"); - - while( $d = mysql_fetch_array($rs) ) - { $parent_router = $d["parent_router"]; } - - $rs2 = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$parent_router'"); - - while( $d2 = mysql_fetch_array($rs2) ) - { $ip_adresa_2 = $d2["ip_adresa"]; } - - if($ip_adresa_2 == $ip_adresa_routeru) - { //dosahlo se reinhard-XY, tj. zaznam CHCEME - return true; - } - elseif($parent_router == "0") - { //dosahlo se reinhard-wifi, takze zaznam nechceme - } - else - { //ani jedno predchozi, rekurze .. :) - if( $this->find_root_router($parent_router, $ip_adresa_routeru) == true) - { return true; } - } - - } //end of function find_root_router - - function find_obj($ip) - { - - //1. zjistit routery co jedou pres reinhard-fiber - $rs_routers = $conn_mysql->query("SELECT id, parent_router, nazev, ip_adresa FROM router_list ORDER BY id"); - $num_rs_routers = mysql_num_rows($rs_routers); - - while($data_routers = mysql_fetch_array($rs_routers)) - { - $id_routeru = $data_routers["id"]; - $ip_adresa = $data_routers["ip_adresa"]; - - if( $this->find_root_router($id_routeru,$ip) === true) - { - $routers[] = $id_routeru; - $routers_ip[] = $ip_adresa; - } - } - - //2. zjistit nody - $i=0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if($i == 0) - { $sql_where .= "'$id_routeru'"; } - else - { $sql_where .= ",'$id_routeru'"; } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - //print $sql."\n"; - - $rs_nods = $conn_mysql->query($sql); - $num_rs_nods = mysql_num_rows($rs_nods); - - while($data_nods = mysql_fetch_array($rs_nods)) - { $nods[] = $data_nods["id"]; } - - //3. zjistit lidi - $i=0; - - foreach($nods as $key => $id_nodu ){ - //print "nods: ".$id_nodu." \n"; - - if($i == 0) - { $sql_obj_where .= "'$id_nodu'"; } - else - { $sql_obj_where .= ",'$id_nodu'"; } - - $i++; - } - - $sql_obj = "SELECT ip, id_tarifu, client_ap_ip FROM objekty WHERE id_nodu IN (".$sql_obj_where.") ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $rs_objects = pg_query($sql_obj); - $num_rs_objects = pg_num_rows($rs_objects); - - while( $data = pg_fetch_array($rs_objects)) - { - $ip = $data["ip"]; - $client_ap_ip = $data["client_ap_ip"]; - - $this->objects[$ip] = $data["id_tarifu"]; - - if( (strlen($client_ap_ip) > 4) ) - { //vyplnena ip adresa apcka - - //zjistit zda-li uz neni - if( !(array_key_exists($client_ap_ip, $this->objects)) ) - { $this->objects[$client_ap_ip] = $this->id_tarifu_routers; } - } - } - - //k seznamu ip adres pridame routery, taky chtej inet :) - foreach($routers_ip as $key => $ip) { - - //zjistit zda uz IP adresa neni v objektu - if( (array_key_exists($ip, $this->objects)) ) - { /* echo " object ".$ip." exists \n"; */ } - else - { $this->objects[$ip] = $this->id_tarifu_routers; } - - } - - print " number of IP addresses via this router: ".count($this->objects); - - if($this->debug == 1){ echo ", count of array objects: ".count($this->objects)." "; } - echo "\n"; - - } //end of function - - function remove_wrong_items($wrong_items) - { - $item_del_ok=0; - $item_del_err=0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/mangle", $wrong_items); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; } - $item_del_ok = count($wrong_items); - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - function detect_diff_in_mangle() - { - - $this->getall_mangle = $this->conn->getall(array("ip", "firewall", "mangle") ); - -/* - if( count($this->getall_mangle) > 0 ) { - print_r($this->getall_mangle); } - else { - echo " Array \"getall_mangle\" is empty \n"; } -*/ - - //priprava zaznamu v routeru - foreach ($this->getall_mangle as $key => $value) { - - $ip_dwn = $this->getall_mangle["$key"]["$this->element_name_dwn"]; - $ip_upl = $this->getall_mangle["$key"]["$this->element_name_upl"]; - - if( isset($this->getall_mangle[$key]["$this->element_name_dwn"]) ) - { - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_dwn"]."_dwn"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_dwn"] = $this->getall_mangle[$key]["$this->element_name_dwn"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $this->arr_objects_dev_dwn[$ip_dwn] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - - //echo "adding: $ip -- $key\n"; - } - elseif( isset($this->getall_mangle[$key]["$this->element_name_upl"]) ) - { - - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_upl"]."_upl"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_upl"] = $this->getall_mangle[$key]["$this->element_name_upl"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $this->arr_objects_dev_upl[$ip_upl] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - } - else - { - echo " WARNING: Nalezeno jiné pravidlo/nelze parsovat. (id: ".$this->getall_mangle["$key"][".id"].") \n"; - - //zde udelat seznam pravidel pro smazani :) - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - - } //end of else if - } - - if( (count($this->wrong_firewall_items) > 0 ) && ($this->force_mangle_rewrite != 1)) - { $this->remove_wrong_items($this->wrong_firewall_items); } - - //print_r($arr_objects_dev_dwn); - //print_r($arr_objects_dev_upl); - if( !(is_array($this->arr_objects_dev_upl)) ) - { $this->arr_objects_dev_upl = array(); } - - if( !(is_array($this->arr_objects_dev_dwn)) ) - { $this->arr_objects_dev_dwn = array(); } - - $arr_obj_dev_diff = array_diff_key($this->arr_objects_dev_dwn, $this->arr_objects_dev_upl); - //print_r($arr_obj_dev_diff); - - $arr_obj_dev_diff2 = array_diff_key($this->arr_objects_dev_upl, $this->arr_objects_dev_dwn); - //print_r($arr_obj_dev_diff2); - - if( (count($arr_obj_dev_diff) > 0) or ( count($arr_obj_dev_diff2) > 0) ) - { - echo " ERROR: Rozdilny pocet zaznamu pro DWN a UPL. Forcing a full sync... \n"; - $this->force_mangle_rewrite = 1; - } - else - { - echo " number of records : device: ".count($this->arr_objects_dev_dwn).", system: ".count($this->objects)."\n"; - - $this->arr_global_diff_exc = array_diff_key($this->arr_objects_dev_dwn, $this->objects); - $this->arr_global_diff_mis = array_diff_key($this->objects, $this->arr_objects_dev_dwn); - } - -} //end of function detect_diff_in_mangle - -function erase_mangle(){ - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->getall_mangle as $key => $value) { - - /* - if(asi nejake vyjimky) - {} - else - */ - { - $erase[] = $this->getall_mangle[$key][".id"]; - //print "erasing id: ".$key."\n"; - } - - } //end of forearch - - $del = $this->conn->remove("/ip/firewall/mangle", $erase); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Item(s) successfully deleted (".count($erase).")\n"; } - $items_suc_del++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - print " count of force deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - //print_r($erase)."\n"; - -} //end of function erase_mangle - -function synchro_mangle_force() -{ - //reseni asi smazat vse a pak pustit synchro_mangle - $this->erase_mangle(); - - $this->detect_diff_in_mangle(); - - $this->synchro_mangle(); - -} //end of function synchro_mangle_force - -function synchro_mangle() -{ - - $items_suc_added = 0; - $items_err_added = 0; - - foreach ($this->arr_global_diff_mis as $ip => $value) { - - $add_par_r = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_dwn", - "$this->item_ip_dwn" => "$ip", "passthrough" => "no"); - $add = $this->conn->add("/ip/firewall/mangle", $add_par_r); - - if( ereg('^\*([[:xdigit:]])*$',$add) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add)."\n"; } - $items_err_added++; - } - - $add_par_r2 = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_upl", - "$this->item_ip_upl" => "$ip", "passthrough" => "no"); - $add2 = $this->conn->add("/ip/firewall/mangle", $add_par_r2); - - if( ereg('^\*([[:xdigit:]])*$',$add2) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add2)."\n"; } - $items_err_added++; - print_r($add_par_r2); - } - - } //end of foreach $arr_global_diff_mis - - print " count of added items: ok: ".$items_suc_added.", error: ".$items_err_added."\n"; - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->arr_global_diff_exc as $ip => $value) { - - $index = $this->arr_objects_dev_dwn["$ip"]; - $index2 = $this->arr_objects_dev_upl["$ip"]; - - //echo " deleted: ".$ip.", v1: $index, v2: $index2 \n"; - - $del = $this->conn->remove("/ip/firewall/mangle", array("$index","$index2") ); - - if( $del == "1" ) - { - if($debug > 0){ echo " Item(s) successfully deleted (".$index.",".$index2.")\n"; } - $items_suc_del++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - } //end of foreach $arr_global_diff_mis - - print " count of deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - -} //end of function synchro_mangle - -function qt_global() { - - //zjisteni agregace SC - $rs_agreg = $conn_mysql->query("SELECT agregace, speed_dwn, speed_upl FROM tarify_int WHERE id_tarifu = '1'"); - - while( $d_agreg = mysql_fetch_array($rs_agreg) ) - { - $this->agregace_sc = $d_agreg["agregace"]; - $this->speed_sc_dwn = $d_agreg["speed_dwn"]; - $this->speed_sc_upl = $d_agreg["speed_upl"]; - } - - foreach ($this->objects as $ip => $linka) { - - if($linka == 1) { - $this->objects_sc[] = $ip; - } - elseif($linka == 0) { - $this->objects_mp[] = $ip; - } - else - { - if(array_key_exists("objects_g_".$linka, $this->objects_garants)) { - //echo " WARNING: garant: "."objects_g_".$linka.", ip> $ip \n"; - $this->{"objects_g_".$linka}[] = $ip; - } - else { - //$this->objects_garants[] - echo " WARNING: Neznámá linka (".$linka.") u objektu: ".$ip."\n"; - } - } - } - - //zredukovat pole objects_garants, dle vyuziti - foreach ($this->objects_garants as $key => $value) { - - if( (count($this->{$key}) > 0 )) { - $this->objects_garants_used[$key] = $value; - } - - } - - //print_r($this->objects_g_2); - //print_r($this->objects_garants_used); - - echo " qt(global) number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - -} - -function qt_delete_all() { - - $qt_suc_del=0; - $qt_err_del=0; - - $qt_del_all = $this->conn->getall(array("queue","tree")); - - foreach ($qt_del_all as $key => $value) { - - $qt_del_all_id[] = $qt_del_all[$key][".id"]; - - } - - $qt_del = $this->conn->remove("/queue/tree", $qt_del_all_id ); - - if( $qt_del == "1" ) { - if($this->debug > 0){ echo " QT Item(s) successfully deleted (".count($qt_del_all_id).")\n"; } - $qt_suc_del++; - } - else { - if($this->debug > 0){ echo " QT ERROR: ".print_r($qt_del_all_id)."\n"; } - $qt_err_del++; - } - - print " qt: deleted items ".count($qt_del_all_id).", ok: ".$qt_suc_del.", error: ".$qt_err_del."\n"; - - // print_r($qt_del_all_id); - -} - -function erase_qt($array){ - - $items_suc_del = 0; - $items_err_del = 0; - - $del = $this->conn->remove("/queue/tree", $array); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Item(s) successfully deleted (".count($erase).")\n"; } - $items_suc_del++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - echo " qt: count of deleted items: ".count($array).", status: "; - - if( $items_suc_del == 1){ echo " OK "; } - elseif( $items_err_del == 1){ echo " error "; } - else - { echo "unknown (ok: ".$items_suc_del.", error: ".$items_err_del.") "; } - - echo "\n"; - - //print_r($array)."\n"; - -} //end of function erase_qt - -function detect_diff_queues() { - - // - //1. zjistime co je v zarizeni - // - - //$qt_dump = $this->conn->getall( array("queue","tree"), "", "", ".id" ); - $qt_dump = $this->conn->getall( array("queue","tree")); - - $qt_dump_trim = $qt_dump; - - //vymazeme .id, jinak nelze pole porovnat - foreach ($qt_dump_trim as $key => $value) { - - unset($qt_dump_trim["$key"][".id"]); - - } //end of foreach qt_dump_trim - - //2. zjistime, co je v adminatoru - - // - // 2.1 SmallCity Linky - // - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - - //2.1.1 - agregacni SC tridy - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false"); - } - - //2.1.2 - jednotlive IP adresy - - $qt_system[] = array ("name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "packet-mark" => $ip."_dwn", - "limit-at" => $limit_at_sc_dwn, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_dwn)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "packet-mark" => $ip."_upl", - "limit-at" => $limit_at_sc_upl, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_upl)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } //end of foreach array objects_sc - - // - // 2.2 - MP linky - // - - //2.2.1 - globalni MP skupiny - $qt_system[] = array ("name" => "q-dwn-mp-global", "parent" => "global-out", "limit-at" => "0", "priority" => "1", - "max-limit" => "100000000", "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-mp-global", "parent" => "global-out", "limit-at" => "0", "priority" => "1", - "max-limit" => "100000000", "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - - //2.2.2 - klientske linky/skupiny - - foreach ($this->objects_mp as $key => $ip) { - - $qt_system[] = array ("name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "packet-mark" => $ip."_dwn", - "limit-at" => "100000", "queue" => "wireless-default", "priority" => "1", - "max-limit" => "10000000", "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "packet-mark" => $ip."_upl", - "limit-at" => "100000", "queue" => "wireless-default", "priority" => "1", - "max-limit" => "10000000", "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - } - - // - // 2.3 - Garanti, routery atd - // - foreach( $this->objects_garants_used as $garant_id => $speeds) - { - list($speed_dwn, $speed_upl) = explode(":",$speeds); - - //parent tridy pro garanty - $qt_system[] = array ("name" => "q-dwn-".$garant_id, "parent" => "global-out", "limit-at" => $speed_dwn."000", - "priority" => "1", "max-limit" => $speed_dwn."000", "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - $qt_system[] = array ("name" => "q-upl-".$garant_id, "parent" => "global-out", "limit-at" => $speed_upl."000", - "priority" => "1", "max-limit" => $speed_upl."000", "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - foreach( $this->{$garant_id} as $id => $ip) - { - - $qt_system[] = array ("name" => "q-dwn-q-".$ip, "parent" => "q-dwn-".$garant_id, "packet-mark" => $ip."_dwn", - "limit-at" => "0", "queue" => "wireless-default", "priority" => "1", "max-limit" => "0", - "burst-limit" => "0", "burst-threshold" => "0", "burst-time" => "00:00:00", - "invalid" => "false", "disabled" => "false" ); - - $qt_system[] = array ("name" => "q-upl-q-".$ip, "parent" => "q-upl-".$garant_id, "packet-mark" => $ip."_upl", - "limit-at" => "0", "queue" => "wireless-default", "priority" => "1", "max-limit" => "0", - "burst-limit" => "0", "burst-threshold" => "0", "burst-time" => "00:00:00", - "invalid" => "false", "disabled" => "false"); - - } - - } - - // - // 3. porovname pole - // - - /* pole se zaznamama */ - //echo "--- printing qt_dump_trim --- \n"; print_r($qt_dump_trim); - //echo "--- printing qt_system --- \n"; print_r($qt_system); - - $this->qt_ar_exc = $this->arrayDiff($qt_dump_trim, $qt_system); - $this->qt_ar_mis = $this->arrayDiff($qt_system, $qt_dump_trim); - - echo " qt: count of classess: excess: ".count($this->qt_ar_exc).", missing: ".count($this->qt_ar_mis)." \n"; - - if( (count($this->qt_ar_exc) > 0 ) or (count($this->qt_ar_mis) > 0 ) ) - { - //neco nesedi .. - //echo "--- printing qt_ar_exc --- \n"; print_r($this->qt_ar_exc); - //echo "--- printing qt_ar_mis --- \n"; print_r($this->qt_ar_mis); - - //prebejvajici zaznamy smazat - - foreach($this->qt_ar_exc as $key => $val) - { - $item_id = $qt_dump[$key][".id"]; - //print " add erase number: ".$key.", item_id: ".$item_id." \n"; - - if( (strlen($item_id) > 0 ) ) - { $qt_delete_items[] = $item_id; } - } //end of foreach this->qt_ar_exc - - if( ( is_array($qt_delete_items) and (count($qt_delete_items) > 0) ) ) - { - //print "--- qt_delete_items --- \n"; print_r($qt_delete_items); - $this->erase_qt($qt_delete_items); - } - else - { echo " qt: no excess items \n"; } - - //pridame chybejici zaznamy - if( ( is_array($this->qt_ar_mis) and (count($this->qt_ar_mis) > 0) ) ) - { - //print_r($this->qt_ar_mis); - - foreach($this->qt_ar_mis as $key => $val) - { - //echo $key." => "; print_r($qt_system[$key])." \n"; - $array = $qt_system[$key]; - - unset($array["invalid"]); - $this->qt_add_single($array); - } - - print " qt: count of adding items: ".count($this->qt_ar_mis).",status: N/A \n"; - - } - else - { echo " qt: no missing items \n"; } - - //a... hotovo :-) - - } - else - { - //zaznamy sedi, nemam co delat - echo " qt: no excess or missing items (OK) \n"; - - } - - -} //end of function datect_diff_queues - -function qt_add_single($input_array) -{ - $qt_items_suc_added = 0; - $qt_items_err_added = 0; - - $add_qt = $this->conn->add("/queue/tree", $input_array); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - //if($this->debug > 0) - { echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - -} //end of qt_add_single - -function synchro_qt_force() -{ - - //for testing, erasing arrays - //$this->objects_sc = array(); - //$this->objects_mp = array(); - - echo " qt - force rewriting ... \n"; - $this->qt_delete_all(); - - echo " tarif info: SmallCity: agregace: ".$this->agregace_sc.", speed dwn: ".$this->speed_sc_dwn."k, upl: ".$this->speed_sc_upl."k \n"; - - echo " qt number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - echo " qt number of records tariff: garants: ".count($this->objects_garants_used)."\n"; - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - $qt_ip_suc_added=0; - $qt_ip_err_added=0; - - //muster queues pro SC - ///queue tree - //add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1024k max-limit=1024k name=\ - // q-dwn-sc-1 parent=global-in priority=1 - - // - // QT - SMallCity - // - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_items_suc_added=0; - $qt_items_err_added=0; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - - print " add QT Group Sc No. ".$sc_group.", items ok: ".$qt_items_suc_added.", error: ".$qt_items_err_added."\n"; - - } - - // add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=1024k name=\ - // q-dwn-sc-10.2.2.2.2 packet-mark=10.52.5.14_dwn parent=q-dwn-sc-1 priority=1 queue=\ - // wireless-default - - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_dwn, "max-limit" => (($this->speed_sc_dwn)*1000), - "name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_upl, "max-limit" => (($this->speed_sc_upl)*1000), - "name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } - - print " qt: count of added items: ok: ".$qt_ip_suc_added.", error: ".$qt_ip_err_added."\n"; - - // - // QT Force - MP linky - // - $qt_mp_items_suc_added=0; - $qt_mp_items_err_added=0; - - //globalni tridy pro MP - - $add_qt_mp_global_data = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-dwn-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global = $this->conn->add("/queue/tree", $add_qt_mp_global_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_mp_global_data2 = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-upl-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global2 = $this->conn->add("/queue/tree", $add_qt_mp_global_data2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global2)."\n"; } - $qt_mp_items_err_added++; - } - - foreach ($this->objects_mp as $key => $ip) { - - $add_qt_data_mp = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_mp = $this->conn->add("/queue/tree", $add_qt_data_mp); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_data_mp2 = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_mp2 = $this->conn->add("/queue/tree", $add_qt_data_mp2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp2)."\n"; } - $qt_mp_items_err_added++; - } - - } - - print " qt: number of records with MP: added items: ok: ".$qt_mp_items_suc_added.", error: ".$qt_mp_items_err_added."\n"; - - // - // QT Force - Garanty - // - $qt_g_items_suc_added = 0; - $qt_g_items_err_added = 0; - - foreach( $this->objects_garants_used as $garant_id => $speeds) - { - list($speed_dwn, $speed_upl) = explode(":",$speeds); - - print " qt-force :: garants :: ".$garant_id.", speed_dwn: ".$speed_dwn.", speed_upl: ".$speed_upl."\n"; - - $add_qt_data_g = array ("disabled" => "false", "limit-at" => $speed_dwn."k", "max-limit" => $speed_dwn."k", - "name" => "q-dwn-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g = $this->conn->add("/queue/tree", $add_qt_data_g); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g) ) - { - if($this->debug > 0){ echo " QT Item (garant parent dwn) ".$add_qt_g." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q)."\n"; } - $qt_g_items_err_added++; - } - - $add_qt_data_g2 = array ("disabled" => "false", "limit-at" => $speed_upl."k", "max-limit" => $speed_upl."k", - "name" => "q-upl-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g2 = $this->conn->add("/queue/tree", $add_qt_data_g2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g2) ) - { - if($this->debug > 0){ echo " QT Item (garant parent upl) ".$add_qt_g2." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q2)."\n"; } - $qt_g_items_err_added++; - } - - foreach( $this->{$garant_id} as $id => $ip) - { - - $add_qt_data_g_dwn = array ("disabled" => "false", "name" => "q-dwn-q-".$ip, "parent" => "q-dwn-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_g_dwn = $this->conn->add("/queue/tree", $add_qt_data_g_dwn); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g_dwn) ) - { - if($this->debug > 0){ echo " QT Item (garant ".$ip." dwn) ".$add_qt_g_dwn." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q_dwn)."\n"; } - $qt_g_items_err_added++; - } - - $add_qt_data_g_upl = array ("disabled" => "false", "name" => "q-upl-q-".$ip, "parent" => "q-upl-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_g_upl = $this->conn->add("/queue/tree", $add_qt_data_g_upl); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g_upl) ) - { - if($this->debug > 0){ echo " QT Item (garant ".$ip." upl) ".$add_qt_g_upl." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q2)."\n"; } - $qt_g_items_err_added++; - } - - - } //end of FOREACH $this->{$garant_id} - - } //end of FOREACH objects_garants_used - - print " qt: number of records with GARANT: added items: ok: ".$qt_g_items_suc_added.", error: ".$qt_g_items_err_added."\n"; - -} //end of function synchro_qt_force - - -} //end of class mk_synchro_qos - - - -?> diff --git a/adminator2/mk_control/testing/2011-03-10-garants-lines&routers/mk_qos_handler.php b/adminator2/mk_control/testing/2011-03-10-garants-lines&routers/mk_qos_handler.php deleted file mode 100644 index 88203c6da..000000000 --- a/adminator2/mk_control/testing/2011-03-10-garants-lines&routers/mk_qos_handler.php +++ /dev/null @@ -1,101 +0,0 @@ -debug=$debug; -$mk_qos->conn=$conn; - -$mk_qos->element_name_dwn=$element_name_dwn; -$mk_qos->element_name_upl=$element_name_upl; - -$mk_qos->item_ip_dwn=$item_ip_dwn; -$mk_qos->item_ip_upl=$item_ip_upl; - -$mk_qos->chain=$chain; - -$mk_qos->find_obj("10.128.0.3"); - -$mk_qos->sc_speed_koef=$sc_speed_koef; - - // - //reseni firewall/mangle - // - - $mk_qos->detect_diff_in_mangle(); - - if($mk_qos->force_mangle_rewrite == 1){ - $mk_qos->synchro_mangle_force(); - } - else - { - print " counts excess ip: ".count($mk_qos->arr_global_diff_exc).", missing ip: ".count($mk_qos->arr_global_diff_mis)."\n"; - $mk_qos->synchro_mangle(); - } - - // - // reseni queue(s) - // - - - $mk_qos->qt_global(); - - //$mk_qos->detect_diff_queues(); - $mk_qos->synchro_qt_force(); - - -?> diff --git a/adminator2/mk_control/testing/2011-03-10-garants-lines&routers/mk_qos_handler_test.php b/adminator2/mk_control/testing/2011-03-10-garants-lines&routers/mk_qos_handler_test.php deleted file mode 100644 index c587c7023..000000000 --- a/adminator2/mk_control/testing/2011-03-10-garants-lines&routers/mk_qos_handler_test.php +++ /dev/null @@ -1,101 +0,0 @@ -debug=$debug; -$mk_qos->conn=$conn; - -$mk_qos->element_name_dwn=$element_name_dwn; -$mk_qos->element_name_upl=$element_name_upl; - -$mk_qos->item_ip_dwn=$item_ip_dwn; -$mk_qos->item_ip_upl=$item_ip_upl; - -$mk_qos->chain=$chain; - -$mk_qos->find_obj("10.128.0.3"); - -$mk_qos->sc_speed_koef=$sc_speed_koef; - - // - //reseni firewall/mangle - // - - $mk_qos->detect_diff_in_mangle(); - - if($mk_qos->force_mangle_rewrite == 1){ - $mk_qos->synchro_mangle_force(); - } - else - { - print " counts excess ip: ".count($mk_qos->arr_global_diff_exc).", missing ip: ".count($mk_qos->arr_global_diff_mis)."\n"; - $mk_qos->synchro_mangle(); - } - - // - // reseni queue(s) - // - - - $mk_qos->qt_global(); - - //$mk_qos->detect_diff_queues(); - $mk_qos->synchro_qt_force(); - - -?> diff --git a/adminator2/mk_control/testing/2011-03-10-garants-lines&routers/ros_api_simelon.php b/adminator2/mk_control/testing/2011-03-10-garants-lines&routers/ros_api_simelon.php deleted file mode 100644 index 2f226f9b6..000000000 --- a/adminator2/mk_control/testing/2011-03-10-garants-lines&routers/ros_api_simelon.php +++ /dev/null @@ -1,885 +0,0 @@ - $second) - { - foreach ($a1 as $key => $first) - { - - if (isset($a2[$key])) - { - foreach ($first as $first_value) - { - foreach ($second as $second_value) - { - if ($first_value == $second_value) - { - $true = true; - break; - } - } - if (!isset($true)) - { - - $r[$key][] = $first_value; - } - unset($true); - } - } - else - { - $r[$key] = $first; - } - } - } - - return $r; - - } //end of function multidimensional array diff - - function find_root_router($id_routeru, $ip_adresa_routeru) - { - $rs = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$id_routeru'"); - - while( $d = mysql_fetch_array($rs) ) - { $parent_router = $d["parent_router"]; } - - $rs2 = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$parent_router'"); - - while( $d2 = mysql_fetch_array($rs2) ) - { $ip_adresa_2 = $d2["ip_adresa"]; } - - if($ip_adresa_2 == $ip_adresa_routeru) - { //dosahlo se reinhard-fiber, tj. zaznam CHCEME - return true; - } - elseif($parent_router == "0") - { //dosahlo se reinhard-wifi, takze zaznam nechceme - } - else - { //ani jedno predchozi, rekurze .. :) - if( $this->find_root_router($parent_router, $ip_adresa_routeru) == true) - { return true; } - } - - } //end of function find_root_router - - function find_obj($ip) - { - - //1. zjistit routery co jedou pres reinhard-fiber - $rs_routers = $conn_mysql->query("SELECT id, parent_router, nazev FROM router_list ORDER BY id"); - $num_rs_routers = mysql_num_rows($rs_routers); - - while($data_routers = mysql_fetch_array($rs_routers)) - { - $id_routeru = $data_routers["id"]; - if( $this->find_root_router($id_routeru,$ip) === true) - { $routers[] = $id_routeru; } - } - - //2. zjistit nody - $i=0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if($i == 0) - { $sql_where .= "'$id_routeru'"; } - else - { $sql_where .= ",'$id_routeru'"; } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - //print $sql."\n"; - - $rs_nods = $conn_mysql->query($sql); - $num_rs_nods = mysql_num_rows($rs_nods); - - while($data_nods = mysql_fetch_array($rs_nods)) - { $nods[] = $data_nods["id"]; } - - //3. zjistit lidi - $i=0; - - foreach ($nods as $key => $id_nodu ){ - //print "nods: ".$id_nodu." \n"; - - if($i == 0) - { $sql_obj_where .= "'$id_nodu'"; } - else - { $sql_obj_where .= ",'$id_nodu'"; } - - $i++; - } - - $sql_obj = "SELECT ip, id_tarifu, dns_jmeno FROM objekty WHERE id_nodu IN (".$sql_obj_where.") ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $rs_objects = pg_query($sql_obj); - $num_rs_objects = pg_num_rows($rs_objects); - - while( $data = pg_fetch_array($rs_objects)) - { - $ip = $data["ip"]; - $this->objects[$ip] = $data["id_tarifu"]; - } - - print " number of IP addresses via this router: ".$num_rs_objects; - if($this->debug == 1){ echo ", count of array objects: ".count($this->objects)." "; } - echo "\n"; - - } //end of function - - function remove_wrong_items($wrong_items) - { - $item_del_ok=0; - $item_del_err=0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/mangle", $wrong_items); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; } - $item_del_ok = count($wrong_items); - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - function detect_diff_in_mangle() - { - - $this->getall_mangle = $this->conn->getall(array("ip", "firewall", "mangle") ); - -/* - if( count($this->getall_mangle) > 0 ) { - print_r($this->getall_mangle); } - else { - echo " Array \"getall_mangle\" is empty \n"; } -*/ - - //priprava zaznamu v routeru - foreach ($this->getall_mangle as $key => $value) { - - $ip_dwn = $this->getall_mangle["$key"]["$this->element_name_dwn"]; - $ip_upl = $this->getall_mangle["$key"]["$this->element_name_upl"]; - - if( isset($this->getall_mangle[$key]["$this->element_name_dwn"]) ) - { - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_dwn"]."_dwn"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_dwn"] = $this->getall_mangle[$key]["$this->element_name_dwn"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $arr_objects_dev_dwn[$ip_dwn] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - - //echo "adding: $ip -- $key\n"; - } - elseif( isset($this->getall_mangle[$key]["$this->element_name_upl"]) ) - { - - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_upl"]."_upl"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_upl"] = $this->getall_mangle[$key]["$this->element_name_upl"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $arr_objects_dev_upl[$ip_upl] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - } - else - { - echo " WARNING: Nalezeno jiné pravidlo/nelze parsovat. (id: ".$this->getall_mangle["$key"][".id"].") \n"; - - //zde udelat seznam pravidel pro smazani :) - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - - } //end of else if - } - - if( (count($this->wrong_firewall_items) > 0 ) && ($this->force_mangle_rewrite != 1)) - { $this->remove_wrong_items($this->wrong_firewall_items); } - - //print_r($arr_objects_dev_dwn); - //print_r($arr_objects_dev_upl); - if( !(is_array($arr_objects_dev_upl)) ) - { $arr_objects_dev_upl = array(); } - - if( !(is_array($arr_objects_dev_dwn)) ) - { $arr_objects_dev_dwn = array(); } - - $arr_obj_dev_diff = array_diff_key($arr_objects_dev_dwn, $arr_objects_dev_upl); - //print_r($arr_obj_dev_diff); - - $arr_obj_dev_diff2 = array_diff_key($arr_objects_dev_upl, $arr_objects_dev_dwn); - //print_r($arr_obj_dev_diff2); - - if( (count($arr_obj_dev_diff) > 0) or ( count($arr_obj_dev_diff2) > 0) ) - { - echo " ERROR: Rozdilny pocet zaznamu pro DWN a UPL. Forcing a full sync... \n"; - $this->force_mangle_rewrite = 1; - } - else - { - echo " number of records : device: ".count($arr_objects_dev_dwn).", system: ".count($this->objects)."\n"; - - $this->arr_global_diff_exc = array_diff_key($arr_objects_dev_dwn, $this->objects); - $this->arr_global_diff_mis = array_diff_key($this->objects, $arr_objects_dev_dwn); - } - -} //end of function detect_diff_in_mangle - -function erase_mangle(){ - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->getall_mangle as $key => $value) { - - /* - if(asi nejake yjimky) - {} - else - */ - { - $erase[] = $this->getall_mangle[$key][".id"]; - //print "erasing id: ".$key."\n"; - } - - } //end of forearch - - $del = $this->conn->remove("/ip/firewall/mangle", $erase); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Item(s) successfully deleted (".count($erase).")\n"; } - $items_suc_del++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - print " count of force deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - //print_r($erase)."\n"; - -} //end of function erase_mangle - -function synchro_mangle_force() -{ - //reseni asi smazat vse a pak pustit synchro_mangle - $this->erase_mangle(); - - $this->detect_diff_in_mangle(); - - $this->synchro_mangle(); - -} //end of function synchro_mangle_force - -function synchro_mangle() -{ - - $items_suc_added = 0; - $items_err_added = 0; - - foreach ($this->arr_global_diff_mis as $ip => $value) { - - $add_par_r = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_dwn", - "$this->item_ip_dwn" => "$ip", "passthrough" => "no"); - $add = $this->conn->add("/ip/firewall/mangle", $add_par_r); - - if( ereg('^\*([[:xdigit:]])*$',$add) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add)."\n"; } - $items_err_added++; - } - - $add_par_r2 = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_upl", - "$this->item_ip_upl" => "$ip", "passthrough" => "no"); - $add2 = $this->conn->add("/ip/firewall/mangle", $add_par_r2); - - if( ereg('^\*([[:xdigit:]])*$',$add2) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add2)."\n"; } - $items_err_added++; - print_r($add_par_r2); - } - - } //end of foreach $arr_global_diff_mis - - print " count of added items: ok: ".$items_suc_added.", error: ".$items_err_added."\n"; - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->arr_global_diff_exc as $ip => $value) { - - $index = $arr_objects_dev_dwn["$ip"]; - $index2 = $arr_objects_dev_upl["$ip"]; - - //echo " deleted: ".$ip.", v1: $index, v2: $index2 \n"; - - $del = $this->conn->remove("/ip/firewall/mangle", array("$index","$index2") ); - - if( $del == "1" ) - { - if($debug > 0){ echo " Item(s) successfully deleted (".$index.",".$index2.")\n"; } - $items_suc_del++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - } //end of foreach $arr_global_diff_mis - - print " count of deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - -} //end of function synchro_mangle - -function qt_global() { - - //zjisteni agregace SC - $rs_agreg = $conn_mysql->query("SELECT agregace, speed_dwn, speed_upl FROM tarify_int WHERE id_tarifu = '1'"); - - while( $d_agreg = mysql_fetch_array($rs_agreg) ) - { - $this->agregace_sc = $d_agreg["agregace"]; - $this->speed_sc_dwn = $d_agreg["speed_dwn"]; - $this->speed_sc_upl = $d_agreg["speed_upl"]; - } - - foreach ($this->objects as $ip => $linka) { - - if($linka == 1) { - $this->objects_sc[] = $ip; - } elseif($linka == 0) { - $this->objects_mp[] = $ip; - } - - //ehm zde garanti este - - else - { - echo " WARNING: Neznámá linka (".$linka.") u objektu: ".$ip."\n"; - } - } - - echo " qt(global) number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - -} - -function qt_delete_all(){ - - $qt_suc_del=0; - $qt_err_del=0; - - $qt_del_all = $this->conn->getall(array("queue","tree")); - - foreach ($qt_del_all as $key => $value) { - - $qt_del_all_id[] = $qt_del_all[$key][".id"]; - - } - - $qt_del = $this->conn->remove("/queue/tree", $qt_del_all_id ); - - if( $qt_del == "1" ) { - if($this->debug > 0){ echo " QT Item(s) successfully deleted (".count($qt_del_all_id).")\n"; } - $qt_suc_del++; - } - else { - if($this->debug > 0){ echo " QT ERROR: ".print_r($qt_del_all_id)."\n"; } - $qt_err_del++; - } - - print " qt: deleted items ".count($qt_del_all_id).", ok: ".$qt_suc_del.", error: ".$qt_err_del."\n"; - - // print_r($qt_del_all_id); - -} - -function detect_diff_queues() { - - //1. zjistime co je v zarizeni - //$qt_dump = $this->conn->getall( array("queue","tree"), "", "", ".id" ); - $qt_dump = $this->conn->getall( array("queue","tree")); - - // print_r($qt_dump); - $qt_dump_trim = $qt_dump; - - //vymazeme .id, jinak nelze pole porovnat - foreach ($qt_dump_trim as $key => $value) { - - unset($qt_dump_trim["$key"][".id"]); - - } //end of foreach qt_dump_trim - - //2. zjistime, co je v adminatoru - - // - // 2.1 SmallCity Linky - // - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - -/* - //muster - [name] => q-dwn-sc-1 - [parent] => global-out - [limit-at] => 2252800 - [priority] => 1 - [max-limit] => 2252800 - [burst-limit] => 0 - [burst-threshold] => 0 - [burst-time] => 00:00:00 - [invalid] => false - [disabled] => false -*/ - - //2.1.1 - agregacni SC tridy - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false"); - } - - //2.1.2 - jednotlive IP adresy - - $qt_system[] = array ("name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "packet-mark" => $ip."_dwn", - "limit-at" => $limit_at_sc_dwn, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_dwn)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "packet-mark" => $ip."_upl", - "limit-at" => $limit_at_sc_upl, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_upl)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } //end of foreach array objects_sc - - // - // 2.2 - MP linky - // - - // - // 2.3 - Garanti - // - - - // - // 3. porovname pole - // - - print_r($qt_dump_trim); - print_r($qt_system); - -/* - if( (count($qt_dump_trim) != count($qt_system) )) - { - echo " qt - does not match the number of elements - forcing rewrite .."; - - $this->synchro_qt_force(); - } - else - { - echo " qt check excess records -- \n"; - - foreach ($qt_dump_trim as $id => $arr_values) { - - $arr2 = array(0); - $arr2 = $qt_system["$id"]; - - $arr_tmp_exc = array_diff($arr_values, $arr2); - - if( (count($arr_tmp_exc) > 0) ) - { - $arr_qt_dev_exc[] = $id; - print_r($arr_tmp_exc); - } - - } //end of foreach $qt_dump_trim - - echo " qt check missing records -- \n"; - - foreach ($qt_system as $id => $arr_values) { - - $arr_tmp_miss = array_diff($arr_values, $qt_dump_trim["$id"]); - - if( (count($arr_tmp_miss) > 0) ) - { - $arr_qt_dev_miss[] = $id; - print_r($arr_tmp_miss); - } - - - } //end of foreach - - //$arr_qt_dev_exc = $this->multidimensional_array_diff($qt_dump_trim, $qt_system); - - //$arr_qt_dev_exc = array_diff($qt_dump_trim, $qt_system); - //print_r($arr_qt_dev_exc); - - //$arr_qt_dev_miss = $this->multidimensional_array_diff($qt_system, $qt_dump_trim); - - //$arr_qt_dev_miss = array_diff($qt_system, $qt_dump_trim); - //print_r($arr_qt_dev_miss); - - echo " qt: number of records : excess: ".count($arr_qt_dev_exc).", missing: ".count($arr_qt_dev_miss)."\n"; - - } //end of else -*/ - -} //end of function datect_diff_queues - -function synchro_qt_force() -{ - - echo " qt - force rewriting ... \n"; - $this->qt_delete_all(); - - echo " tarif info: SmallCity: agregace: ".$this->agregace_sc.", speed dwn: ".$this->speed_sc_dwn."k, upl: ".$this->speed_sc_upl."k \n"; - - echo " qt number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - $qt_ip_suc_added=0; - $qt_ip_err_added=0; - - //muster queues pro SC - ///queue tree - //add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1024k max-limit=1024k name=\ - // q-dwn-sc-1 parent=global-in priority=1 - - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_items_suc_added=0; - $qt_items_err_added=0; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - - print " add QT Group Sc No. ".$sc_group.", items ok: ".$qt_items_suc_added.", error: ".$qt_items_err_added."\n"; - - } - - // add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=1024k name=\ - // q-dwn-sc-10.2.2.2.2 packet-mark=10.52.5.14_dwn parent=q-dwn-sc-1 priority=1 queue=\ - // wireless-default - - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_dwn, "max-limit" => (($this->speed_sc_dwn)*1000), - "name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_upl, "max-limit" => (($this->speed_sc_upl)*1000), - "name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } - - print " qt: count of added items: ok: ".$qt_ip_suc_added.", error: ".$qt_ip_err_added."\n"; - - // - // MP linky - // - $qt_mp_items_suc_added=0; - $qt_mp_items_err_added=0; - - //globalni tridy pro MP - - $add_qt_mp_global_data = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-dwn-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global = $this->conn->add("/queue/tree", $add_qt_mp_global_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_mp_global_data2 = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-upl-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global2 = $this->conn->add("/queue/tree", $add_qt_mp_global_data2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global2)."\n"; } - $qt_mp_items_err_added++; - } - - foreach ($this->objects_mp as $key => $ip) { - - $add_qt_data_mp = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_mp = $this->conn->add("/queue/tree", $add_qt_data_mp); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_data_mp2 = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_mp2 = $this->conn->add("/queue/tree", $add_qt_data_mp2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp2)."\n"; } - $qt_mp_items_err_added++; - } - - } - - print " qt: number of records with MP: added items: ok: ".$qt_mp_items_suc_added.", error: ".$qt_mp_items_err_added."\n"; - -} //end of function synchro_qt_force - - -} //end of class mk_synchro_qos - - - -?> diff --git a/adminator2/mk_control/testing/2011-03-10-garants-lines&routers/ros_api_simelon_test.php b/adminator2/mk_control/testing/2011-03-10-garants-lines&routers/ros_api_simelon_test.php deleted file mode 100644 index 81118e6dc..000000000 --- a/adminator2/mk_control/testing/2011-03-10-garants-lines&routers/ros_api_simelon_test.php +++ /dev/null @@ -1,1044 +0,0 @@ -query("SELECT id_tarifu, zkratka_tarifu, speed_dwn, speed_upl - FROM tarify_int - WHERE (typ_tarifu = '0' AND garant = '1') - ORDER BY id_tarifu"); - - while($data = mysql_fetch_array($q)) - { - $id = "objects_g_".$data["id_tarifu"]; - $this->objects_garants[$id] = $data["speed_dwn"].":".$data["speed_upl"]; - } - - } //end of function contsruct - - function multidimensional_array_diff($a1,$a2) - { - $r = array(); - - foreach ($a2 as $key => $second) - { - foreach ($a1 as $key => $first) - { - - if (isset($a2[$key])) - { - foreach ($first as $first_value) - { - foreach ($second as $second_value) - { - if ($first_value == $second_value) - { - $true = true; - break; - } - } - if (!isset($true)) - { - - $r[$key][] = $first_value; - } - unset($true); - } - } - else - { - $r[$key] = $first; - } - } - } - - return $r; - - } //end of function multidimensional array diff - - function find_root_router($id_routeru, $ip_adresa_routeru) - { - $rs = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$id_routeru'"); - - while( $d = mysql_fetch_array($rs) ) - { $parent_router = $d["parent_router"]; } - - $rs2 = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$parent_router'"); - - while( $d2 = mysql_fetch_array($rs2) ) - { $ip_adresa_2 = $d2["ip_adresa"]; } - - if($ip_adresa_2 == $ip_adresa_routeru) - { //dosahlo se reinhard-fiber, tj. zaznam CHCEME - return true; - } - elseif($parent_router == "0") - { //dosahlo se reinhard-wifi, takze zaznam nechceme - } - else - { //ani jedno predchozi, rekurze .. :) - if( $this->find_root_router($parent_router, $ip_adresa_routeru) == true) - { return true; } - } - - } //end of function find_root_router - - function find_obj($ip) - { - - //1. zjistit routery co jedou pres reinhard-fiber - $rs_routers = $conn_mysql->query("SELECT id, parent_router, nazev, ip_adresa FROM router_list ORDER BY id"); - $num_rs_routers = mysql_num_rows($rs_routers); - - while($data_routers = mysql_fetch_array($rs_routers)) - { - $id_routeru = $data_routers["id"]; - $ip_adresa = $data_routers["ip_adresa"]; - - if( $this->find_root_router($id_routeru,$ip) === true) - { - $routers[] = $id_routeru; - $routers_ip[] = $ip_adresa; - } - } - - //2. zjistit nody - $i=0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if($i == 0) - { $sql_where .= "'$id_routeru'"; } - else - { $sql_where .= ",'$id_routeru'"; } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - //print $sql."\n"; - - $rs_nods = $conn_mysql->query($sql); - $num_rs_nods = mysql_num_rows($rs_nods); - - while($data_nods = mysql_fetch_array($rs_nods)) - { $nods[] = $data_nods["id"]; } - - //3. zjistit lidi - $i=0; - - foreach ($nods as $key => $id_nodu ){ - //print "nods: ".$id_nodu." \n"; - - if($i == 0) - { $sql_obj_where .= "'$id_nodu'"; } - else - { $sql_obj_where .= ",'$id_nodu'"; } - - $i++; - } - - $sql_obj = "SELECT ip, id_tarifu, dns_jmeno FROM objekty WHERE id_nodu IN (".$sql_obj_where.") ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $rs_objects = pg_query($sql_obj); - $num_rs_objects = pg_num_rows($rs_objects); - - while( $data = pg_fetch_array($rs_objects)) - { - $ip = $data["ip"]; - $this->objects[$ip] = $data["id_tarifu"]; - } - - //k seznamu ip adres pridame routery, jak chtej inet :) - foreach ($routers_ip as $key => $ip) { - - //zjistit zda uz IP adresa neni v objektu - if ( (array_key_exists($ip, $this->objects)) ) - { - //echo " object ".$ip." exists \n"; - } - else - { - $this->objects[$ip] = $this->id_tarifu_routers; - } - - } - - print " number of IP addresses via this router: ".$num_rs_objects; - if($this->debug == 1){ echo ", count of array objects: ".count($this->objects)." "; } - echo "\n"; - - } //end of function - - function remove_wrong_items($wrong_items) - { - $item_del_ok=0; - $item_del_err=0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/mangle", $wrong_items); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; } - $item_del_ok = count($wrong_items); - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - function detect_diff_in_mangle() - { - - $this->getall_mangle = $this->conn->getall(array("ip", "firewall", "mangle") ); - -/* - if( count($this->getall_mangle) > 0 ) { - print_r($this->getall_mangle); } - else { - echo " Array \"getall_mangle\" is empty \n"; } -*/ - - //priprava zaznamu v routeru - foreach ($this->getall_mangle as $key => $value) { - - $ip_dwn = $this->getall_mangle["$key"]["$this->element_name_dwn"]; - $ip_upl = $this->getall_mangle["$key"]["$this->element_name_upl"]; - - if( isset($this->getall_mangle[$key]["$this->element_name_dwn"]) ) - { - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_dwn"]."_dwn"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_dwn"] = $this->getall_mangle[$key]["$this->element_name_dwn"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $this->arr_objects_dev_dwn[$ip_dwn] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - - //echo "adding: $ip -- $key\n"; - } - elseif( isset($this->getall_mangle[$key]["$this->element_name_upl"]) ) - { - - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_upl"]."_upl"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_upl"] = $this->getall_mangle[$key]["$this->element_name_upl"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $this->arr_objects_dev_upl[$ip_upl] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - } - else - { - echo " WARNING: Nalezeno jiné pravidlo/nelze parsovat. (id: ".$this->getall_mangle["$key"][".id"].") \n"; - - //zde udelat seznam pravidel pro smazani :) - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - - } //end of else if - } - - if( (count($this->wrong_firewall_items) > 0 ) && ($this->force_mangle_rewrite != 1)) - { $this->remove_wrong_items($this->wrong_firewall_items); } - - //print_r($arr_objects_dev_dwn); - //print_r($arr_objects_dev_upl); - if( !(is_array($this->arr_objects_dev_upl)) ) - { $this->arr_objects_dev_upl = array(); } - - if( !(is_array($this->arr_objects_dev_dwn)) ) - { $this->arr_objects_dev_dwn = array(); } - - $arr_obj_dev_diff = array_diff_key($this->arr_objects_dev_dwn, $this->arr_objects_dev_upl); - //print_r($arr_obj_dev_diff); - - $arr_obj_dev_diff2 = array_diff_key($this->arr_objects_dev_upl, $this->arr_objects_dev_dwn); - //print_r($arr_obj_dev_diff2); - - if( (count($arr_obj_dev_diff) > 0) or ( count($arr_obj_dev_diff2) > 0) ) - { - echo " ERROR: Rozdilny pocet zaznamu pro DWN a UPL. Forcing a full sync... \n"; - $this->force_mangle_rewrite = 1; - } - else - { - echo " number of records : device: ".count($this->arr_objects_dev_dwn).", system: ".count($this->objects)."\n"; - - $this->arr_global_diff_exc = array_diff_key($this->arr_objects_dev_dwn, $this->objects); - $this->arr_global_diff_mis = array_diff_key($this->objects, $this->arr_objects_dev_dwn); - } - -} //end of function detect_diff_in_mangle - -function erase_mangle(){ - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->getall_mangle as $key => $value) { - - /* - if(asi nejake yjimky) - {} - else - */ - { - $erase[] = $this->getall_mangle[$key][".id"]; - //print "erasing id: ".$key."\n"; - } - - } //end of forearch - - $del = $this->conn->remove("/ip/firewall/mangle", $erase); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Item(s) successfully deleted (".count($erase).")\n"; } - $items_suc_del++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - print " count of force deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - //print_r($erase)."\n"; - -} //end of function erase_mangle - -function synchro_mangle_force() -{ - //reseni asi smazat vse a pak pustit synchro_mangle - $this->erase_mangle(); - - $this->detect_diff_in_mangle(); - - $this->synchro_mangle(); - -} //end of function synchro_mangle_force - -function synchro_mangle() -{ - - $items_suc_added = 0; - $items_err_added = 0; - - foreach ($this->arr_global_diff_mis as $ip => $value) { - - $add_par_r = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_dwn", - "$this->item_ip_dwn" => "$ip", "passthrough" => "no"); - $add = $this->conn->add("/ip/firewall/mangle", $add_par_r); - - if( ereg('^\*([[:xdigit:]])*$',$add) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add)."\n"; } - $items_err_added++; - } - - $add_par_r2 = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_upl", - "$this->item_ip_upl" => "$ip", "passthrough" => "no"); - $add2 = $this->conn->add("/ip/firewall/mangle", $add_par_r2); - - if( ereg('^\*([[:xdigit:]])*$',$add2) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add2)."\n"; } - $items_err_added++; - print_r($add_par_r2); - } - - } //end of foreach $arr_global_diff_mis - - print " count of added items: ok: ".$items_suc_added.", error: ".$items_err_added."\n"; - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->arr_global_diff_exc as $ip => $value) { - - $index = $this->arr_objects_dev_dwn["$ip"]; - $index2 = $this->arr_objects_dev_upl["$ip"]; - - //echo " deleted: ".$ip.", v1: $index, v2: $index2 \n"; - - $del = $this->conn->remove("/ip/firewall/mangle", array("$index","$index2") ); - - if( $del == "1" ) - { - if($debug > 0){ echo " Item(s) successfully deleted (".$index.",".$index2.")\n"; } - $items_suc_del++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - } //end of foreach $arr_global_diff_mis - - print " count of deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - -} //end of function synchro_mangle - -function qt_global() { - - //zjisteni agregace SC - $rs_agreg = $conn_mysql->query("SELECT agregace, speed_dwn, speed_upl FROM tarify_int WHERE id_tarifu = '1'"); - - while( $d_agreg = mysql_fetch_array($rs_agreg) ) - { - $this->agregace_sc = $d_agreg["agregace"]; - $this->speed_sc_dwn = $d_agreg["speed_dwn"]; - $this->speed_sc_upl = $d_agreg["speed_upl"]; - } - - foreach ($this->objects as $ip => $linka) { - - if($linka == 1) { - $this->objects_sc[] = $ip; - } - elseif($linka == 0) { - $this->objects_mp[] = $ip; - } - else - { - if(array_key_exists("objects_g_".$linka, $this->objects_garants)) { - //echo " WARNING: garant: "."objects_g_".$linka.", ip> $ip \n"; - $this->{"objects_g_".$linka}[] = $ip; - } - else { - //$this->objects_garants[] - echo " WARNING: Neznámá linka (".$linka.") u objektu: ".$ip."\n"; - } - } - } - - //zredukovat pole objects_garants, dle vyuziti - foreach ($this->objects_garants as $key => $value) { - - if( (count($this->{$key}) > 0 )) { - $this->objects_garants_used[$key] = $value; - } - - } - - //print_r($this->objects_g_2); - //print_r($this->objects_garants_used); - - echo " qt(global) number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - -} - -function qt_delete_all() { - - $qt_suc_del=0; - $qt_err_del=0; - - $qt_del_all = $this->conn->getall(array("queue","tree")); - - foreach ($qt_del_all as $key => $value) { - - $qt_del_all_id[] = $qt_del_all[$key][".id"]; - - } - - $qt_del = $this->conn->remove("/queue/tree", $qt_del_all_id ); - - if( $qt_del == "1" ) { - if($this->debug > 0){ echo " QT Item(s) successfully deleted (".count($qt_del_all_id).")\n"; } - $qt_suc_del++; - } - else { - if($this->debug > 0){ echo " QT ERROR: ".print_r($qt_del_all_id)."\n"; } - $qt_err_del++; - } - - print " qt: deleted items ".count($qt_del_all_id).", ok: ".$qt_suc_del.", error: ".$qt_err_del."\n"; - - // print_r($qt_del_all_id); - -} - -function detect_diff_queues() { - - //1. zjistime co je v zarizeni - //$qt_dump = $this->conn->getall( array("queue","tree"), "", "", ".id" ); - $qt_dump = $this->conn->getall( array("queue","tree")); - - // print_r($qt_dump); - $qt_dump_trim = $qt_dump; - - //vymazeme .id, jinak nelze pole porovnat - foreach ($qt_dump_trim as $key => $value) { - - unset($qt_dump_trim["$key"][".id"]); - - } //end of foreach qt_dump_trim - - //2. zjistime, co je v adminatoru - - // - // 2.1 SmallCity Linky - // - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - -/* - //muster - [name] => q-dwn-sc-1 - [parent] => global-out - [limit-at] => 2252800 - [priority] => 1 - [max-limit] => 2252800 - [burst-limit] => 0 - [burst-threshold] => 0 - [burst-time] => 00:00:00 - [invalid] => false - [disabled] => false -*/ - - //2.1.1 - agregacni SC tridy - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false"); - } - - //2.1.2 - jednotlive IP adresy - - $qt_system[] = array ("name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "packet-mark" => $ip."_dwn", - "limit-at" => $limit_at_sc_dwn, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_dwn)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "packet-mark" => $ip."_upl", - "limit-at" => $limit_at_sc_upl, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_upl)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } //end of foreach array objects_sc - - // - // 2.2 - MP linky - // - - // - // 2.3 - Garanti - // - - - // - // 3. porovname pole - // - - print_r($qt_dump_trim); - print_r($qt_system); - -/* - if( (count($qt_dump_trim) != count($qt_system) )) - { - echo " qt - does not match the number of elements - forcing rewrite .."; - - $this->synchro_qt_force(); - } - else - { - echo " qt check excess records -- \n"; - - foreach ($qt_dump_trim as $id => $arr_values) { - - $arr2 = array(0); - $arr2 = $qt_system["$id"]; - - $arr_tmp_exc = array_diff($arr_values, $arr2); - - if( (count($arr_tmp_exc) > 0) ) - { - $arr_qt_dev_exc[] = $id; - print_r($arr_tmp_exc); - } - - } //end of foreach $qt_dump_trim - - echo " qt check missing records -- \n"; - - foreach ($qt_system as $id => $arr_values) { - - $arr_tmp_miss = array_diff($arr_values, $qt_dump_trim["$id"]); - - if( (count($arr_tmp_miss) > 0) ) - { - $arr_qt_dev_miss[] = $id; - print_r($arr_tmp_miss); - } - - - } //end of foreach - - //$arr_qt_dev_exc = $this->multidimensional_array_diff($qt_dump_trim, $qt_system); - - //$arr_qt_dev_exc = array_diff($qt_dump_trim, $qt_system); - //print_r($arr_qt_dev_exc); - - //$arr_qt_dev_miss = $this->multidimensional_array_diff($qt_system, $qt_dump_trim); - - //$arr_qt_dev_miss = array_diff($qt_system, $qt_dump_trim); - //print_r($arr_qt_dev_miss); - - echo " qt: number of records : excess: ".count($arr_qt_dev_exc).", missing: ".count($arr_qt_dev_miss)."\n"; - - } //end of else -*/ - -} //end of function datect_diff_queues - -function synchro_qt_force() -{ - - //for testing, erasing arrays - $this->objects_sc = array(); - $this->objects_mp = array(); - - echo " qt - force rewriting ... \n"; - $this->qt_delete_all(); - - echo " tarif info: SmallCity: agregace: ".$this->agregace_sc.", speed dwn: ".$this->speed_sc_dwn."k, upl: ".$this->speed_sc_upl."k \n"; - - echo " qt number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - echo " qt number of records tariff: garants: ".count($this->objects_garants_used)."\n"; - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - $qt_ip_suc_added=0; - $qt_ip_err_added=0; - - //muster queues pro SC - ///queue tree - //add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1024k max-limit=1024k name=\ - // q-dwn-sc-1 parent=global-in priority=1 - - // - // QT - SMallCity - // - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_items_suc_added=0; - $qt_items_err_added=0; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - - print " add QT Group Sc No. ".$sc_group.", items ok: ".$qt_items_suc_added.", error: ".$qt_items_err_added."\n"; - - } - - // add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=1024k name=\ - // q-dwn-sc-10.2.2.2.2 packet-mark=10.52.5.14_dwn parent=q-dwn-sc-1 priority=1 queue=\ - // wireless-default - - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_dwn, "max-limit" => (($this->speed_sc_dwn)*1000), - "name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_upl, "max-limit" => (($this->speed_sc_upl)*1000), - "name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } - - print " qt: count of added items: ok: ".$qt_ip_suc_added.", error: ".$qt_ip_err_added."\n"; - - // - // QT Force - MP linky - // - $qt_mp_items_suc_added=0; - $qt_mp_items_err_added=0; - - //globalni tridy pro MP - - $add_qt_mp_global_data = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-dwn-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global = $this->conn->add("/queue/tree", $add_qt_mp_global_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_mp_global_data2 = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-upl-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global2 = $this->conn->add("/queue/tree", $add_qt_mp_global_data2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global2)."\n"; } - $qt_mp_items_err_added++; - } - - foreach ($this->objects_mp as $key => $ip) { - - $add_qt_data_mp = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_mp = $this->conn->add("/queue/tree", $add_qt_data_mp); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_data_mp2 = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_mp2 = $this->conn->add("/queue/tree", $add_qt_data_mp2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp2)."\n"; } - $qt_mp_items_err_added++; - } - - } - - print " qt: number of records with MP: added items: ok: ".$qt_mp_items_suc_added.", error: ".$qt_mp_items_err_added."\n"; - - // - // QT Force - Garanty - // - $qt_g_items_suc_added = 0; - $qt_g_items_err_added = 0; - - foreach( $this->objects_garants_used as $garant_id => $speeds) - { - list($speed_dwn, $speed_upl) = explode(":",$speeds); - - print " qt-force :: garants :: ".$garant_id.", speed_dwn: ".$speed_dwn.", speed_upl: ".$speed_upl."\n"; - - $add_qt_data_g = array ("disabled" => "false", "limit-at" => $speed_dwn."k", "max-limit" => $speed_dwn."k", - "name" => "q-dwn-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g = $this->conn->add("/queue/tree", $add_qt_data_g); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g) ) - { - if($this->debug > 0){ echo " QT Item (garant parent dwn) ".$add_qt_g." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q)."\n"; } - $qt_g_items_err_added++; - } - - $add_qt_data_g2 = array ("disabled" => "false", "limit-at" => $speed_upl."k", "max-limit" => $speed_upl."k", - "name" => "q-upl-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g2 = $this->conn->add("/queue/tree", $add_qt_data_g2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g2) ) - { - if($this->debug > 0){ echo " QT Item (garant parent upl) ".$add_qt_g2." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q2)."\n"; } - $qt_g_items_err_added++; - } - - foreach( $this->{$garant_id} as $id => $ip) - { - - $add_qt_data_g_dwn = array ("disabled" => "false", "name" => "q-dwn-q-".$ip, "parent" => "q-dwn-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_g_dwn = $this->conn->add("/queue/tree", $add_qt_data_g_dwn); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g_dwn) ) - { - if($this->debug > 0){ echo " QT Item (garant ".$ip." dwn) ".$add_qt_g_dwn." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q_dwn)."\n"; } - $qt_g_items_err_added++; - } - - $add_qt_data_g_upl = array ("disabled" => "false", "name" => "q-upl-q-".$ip, "parent" => "q-upl-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_g_upl = $this->conn->add("/queue/tree", $add_qt_data_g_upl); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g_upl) ) - { - if($this->debug > 0){ echo " QT Item (garant ".$ip." upl) ".$add_qt_g_upl." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q2)."\n"; } - $qt_g_items_err_added++; - } - - - } //end of FOREACH $this->{$garant_id} - - } //end of FOREACH objects_garants_used - - print " qt: number of records with GARANT: added items: ok: ".$qt_g_items_suc_added.", error: ".$qt_g_items_err_added."\n"; - -} //end of function synchro_qt_force - - -} //end of class mk_synchro_qos - - - -?> diff --git a/adminator2/mk_control/testing/2011-03-11/mk_qos_handler.php b/adminator2/mk_control/testing/2011-03-11/mk_qos_handler.php deleted file mode 100644 index 88203c6da..000000000 --- a/adminator2/mk_control/testing/2011-03-11/mk_qos_handler.php +++ /dev/null @@ -1,101 +0,0 @@ -debug=$debug; -$mk_qos->conn=$conn; - -$mk_qos->element_name_dwn=$element_name_dwn; -$mk_qos->element_name_upl=$element_name_upl; - -$mk_qos->item_ip_dwn=$item_ip_dwn; -$mk_qos->item_ip_upl=$item_ip_upl; - -$mk_qos->chain=$chain; - -$mk_qos->find_obj("10.128.0.3"); - -$mk_qos->sc_speed_koef=$sc_speed_koef; - - // - //reseni firewall/mangle - // - - $mk_qos->detect_diff_in_mangle(); - - if($mk_qos->force_mangle_rewrite == 1){ - $mk_qos->synchro_mangle_force(); - } - else - { - print " counts excess ip: ".count($mk_qos->arr_global_diff_exc).", missing ip: ".count($mk_qos->arr_global_diff_mis)."\n"; - $mk_qos->synchro_mangle(); - } - - // - // reseni queue(s) - // - - - $mk_qos->qt_global(); - - //$mk_qos->detect_diff_queues(); - $mk_qos->synchro_qt_force(); - - -?> diff --git a/adminator2/mk_control/testing/2011-03-11/mk_qos_handler_test.php b/adminator2/mk_control/testing/2011-03-11/mk_qos_handler_test.php deleted file mode 100644 index a0bbf7be8..000000000 --- a/adminator2/mk_control/testing/2011-03-11/mk_qos_handler_test.php +++ /dev/null @@ -1,101 +0,0 @@ -debug=$debug; -$mk_qos->conn=$conn; - -$mk_qos->element_name_dwn=$element_name_dwn; -$mk_qos->element_name_upl=$element_name_upl; - -$mk_qos->item_ip_dwn=$item_ip_dwn; -$mk_qos->item_ip_upl=$item_ip_upl; - -$mk_qos->chain=$chain; - -$mk_qos->find_obj("10.128.0.3"); - -$mk_qos->sc_speed_koef=$sc_speed_koef; - - // - //reseni firewall/mangle - // - - $mk_qos->detect_diff_in_mangle(); - - if($mk_qos->force_mangle_rewrite == 1){ - $mk_qos->synchro_mangle_force(); - } - else - { - print " counts excess ip: ".count($mk_qos->arr_global_diff_exc).", missing ip: ".count($mk_qos->arr_global_diff_mis)."\n"; - $mk_qos->synchro_mangle(); - } - - // - // reseni queue(s) - // - - - $mk_qos->qt_global(); - - $mk_qos->detect_diff_queues(); - //$mk_qos->synchro_qt_force(); - - -?> diff --git a/adminator2/mk_control/testing/2011-03-11/ros_api_simelon.php b/adminator2/mk_control/testing/2011-03-11/ros_api_simelon.php deleted file mode 100644 index 42a8bb075..000000000 --- a/adminator2/mk_control/testing/2011-03-11/ros_api_simelon.php +++ /dev/null @@ -1,885 +0,0 @@ - $second) - { - foreach ($a1 as $key => $first) - { - - if (isset($a2[$key])) - { - foreach ($first as $first_value) - { - foreach ($second as $second_value) - { - if ($first_value == $second_value) - { - $true = true; - break; - } - } - if (!isset($true)) - { - - $r[$key][] = $first_value; - } - unset($true); - } - } - else - { - $r[$key] = $first; - } - } - } - - return $r; - - } //end of function multidimensional array diff - - function find_root_router($id_routeru, $ip_adresa_routeru) - { - $rs = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$id_routeru'"); - - while( $d = mysql_fetch_array($rs) ) - { $parent_router = $d["parent_router"]; } - - $rs2 = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$parent_router'"); - - while( $d2 = mysql_fetch_array($rs2) ) - { $ip_adresa_2 = $d2["ip_adresa"]; } - - if($ip_adresa_2 == $ip_adresa_routeru) - { //dosahlo se reinhard-fiber, tj. zaznam CHCEME - return true; - } - elseif($parent_router == "0") - { //dosahlo se reinhard-wifi, takze zaznam nechceme - } - else - { //ani jedno predchozi, rekurze .. :) - if( $this->find_root_router($parent_router, $ip_adresa_routeru) == true) - { return true; } - } - - } //end of function find_root_router - - function find_obj($ip) - { - - //1. zjistit routery co jedou pres reinhard-fiber - $rs_routers = $conn_mysql->query("SELECT id, parent_router, nazev FROM router_list ORDER BY id"); - $num_rs_routers = mysql_num_rows($rs_routers); - - while($data_routers = mysql_fetch_array($rs_routers)) - { - $id_routeru = $data_routers["id"]; - if( $this->find_root_router($id_routeru,$ip) === true) - { $routers[] = $id_routeru; } - } - - //2. zjistit nody - $i=0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if($i == 0) - { $sql_where .= "'$id_routeru'"; } - else - { $sql_where .= ",'$id_routeru'"; } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - //print $sql."\n"; - - $rs_nods = $conn_mysql->query($sql); - $num_rs_nods = mysql_num_rows($rs_nods); - - while($data_nods = mysql_fetch_array($rs_nods)) - { $nods[] = $data_nods["id"]; } - - //3. zjistit lidi - $i=0; - - foreach ($nods as $key => $id_nodu ){ - //print "nods: ".$id_nodu." \n"; - - if($i == 0) - { $sql_obj_where .= "'$id_nodu'"; } - else - { $sql_obj_where .= ",'$id_nodu'"; } - - $i++; - } - - $sql_obj = "SELECT ip, id_tarifu, dns_jmeno FROM objekty WHERE id_nodu IN (".$sql_obj_where.") ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $rs_objects = pg_query($sql_obj); - $num_rs_objects = pg_num_rows($rs_objects); - - while( $data = pg_fetch_array($rs_objects)) - { - $ip = $data["ip"]; - $this->objects[$ip] = $data["id_tarifu"]; - } - - print " number of IP addresses via this router: ".$num_rs_objects; - if($this->debug == 1){ echo ", count of array objects: ".count($this->objects)." "; } - echo "\n"; - - } //end of function - - function remove_wrong_items($wrong_items) - { - $item_del_ok=0; - $item_del_err=0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/mangle", $wrong_items); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; } - $item_del_ok = count($wrong_items); - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - function detect_diff_in_mangle() - { - - $this->getall_mangle = $this->conn->getall(array("ip", "firewall", "mangle") ); - -/* - if( count($this->getall_mangle) > 0 ) { - print_r($this->getall_mangle); } - else { - echo " Array \"getall_mangle\" is empty \n"; } -*/ - - //priprava zaznamu v routeru - foreach ($this->getall_mangle as $key => $value) { - - $ip_dwn = $this->getall_mangle["$key"]["$this->element_name_dwn"]; - $ip_upl = $this->getall_mangle["$key"]["$this->element_name_upl"]; - - if( isset($this->getall_mangle[$key]["$this->element_name_dwn"]) ) - { - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_dwn"]."_dwn"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_dwn"] = $this->getall_mangle[$key]["$this->element_name_dwn"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $arr_objects_dev_dwn[$ip_dwn] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - - //echo "adding: $ip -- $key\n"; - } - elseif( isset($this->getall_mangle[$key]["$this->element_name_upl"]) ) - { - - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_upl"]."_upl"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_upl"] = $this->getall_mangle[$key]["$this->element_name_upl"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $arr_objects_dev_upl[$ip_upl] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - } - else - { - echo " WARNING: Nalezeno jiné pravidlo/nelze parsovat. (id: ".$this->getall_mangle["$key"][".id"].") \n"; - - //zde udelat seznam pravidel pro smazani :) - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - - } //end of else if - } - - if( (count($this->wrong_firewall_items) > 0 ) && ($this->force_mangle_rewrite != 1)) - { $this->remove_wrong_items($this->wrong_firewall_items); } - - //print_r($arr_objects_dev_dwn); - //print_r($arr_objects_dev_upl); - if( !(is_array($arr_objects_dev_upl)) ) - { $arr_objects_dev_upl = array(); } - - if( !(is_array($arr_objects_dev_dwn)) ) - { $arr_objects_dev_dwn = array(); } - - $arr_obj_dev_diff = array_diff_key($arr_objects_dev_dwn, $arr_objects_dev_upl); - //print_r($arr_obj_dev_diff); - - $arr_obj_dev_diff2 = array_diff_key($arr_objects_dev_upl, $arr_objects_dev_dwn); - //print_r($arr_obj_dev_diff2); - - if( (count($arr_obj_dev_diff) > 0) or ( count($arr_obj_dev_diff2) > 0) ) - { - echo " ERROR: Rozdilny pocet zaznamu pro DWN a UPL. Forcing a full sync... \n"; - $this->force_mangle_rewrite = 1; - } - else - { - echo " number of records : device: ".count($arr_objects_dev_dwn).", system: ".count($this->objects)."\n"; - - $this->arr_global_diff_exc = array_diff_key($arr_objects_dev_dwn, $this->objects); - $this->arr_global_diff_mis = array_diff_key($this->objects, $arr_objects_dev_dwn); - } - -} //end of function detect_diff_in_mangle - -function erase_mangle(){ - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->getall_mangle as $key => $value) { - - /* - if(asi nejake yjimky) - {} - else - */ - { - $erase[] = $this->getall_mangle[$key][".id"]; - //print "erasing id: ".$key."\n"; - } - - } //end of forearch - - $del = $this->conn->remove("/ip/firewall/mangle", $erase); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Item(s) successfully deleted (".count($erase).")\n"; } - $items_suc_del++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - print " count of force deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - //print_r($erase)."\n"; - -} //end of function erase_mangle - -function synchro_mangle_force() -{ - //reseni asi smazat vse a pak pustit synchro_mangle - $this->erase_mangle(); - - $this->detect_diff_in_mangle(); - - $this->synchro_mangle(); - -} //end of function synchro_mangle_force - -function synchro_mangle() -{ - - $items_suc_added = 0; - $items_err_added = 0; - - foreach ($this->arr_global_diff_mis as $ip => $value) { - - $add_par_r = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_dwn", - "$this->item_ip_dwn" => "$ip", "passthrough" => "no"); - $add = $this->conn->add("/ip/firewall/mangle", $add_par_r); - - if( ereg('^\*([[:xdigit:]])*$',$add) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add)."\n"; } - $items_err_added++; - } - - $add_par_r2 = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_upl", - "$this->item_ip_upl" => "$ip", "passthrough" => "no"); - $add2 = $this->conn->add("/ip/firewall/mangle", $add_par_r2); - - if( ereg('^\*([[:xdigit:]])*$',$add2) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add2)."\n"; } - $items_err_added++; - print_r($add_par_r2); - } - - } //end of foreach $arr_global_diff_mis - - print " count of added items: ok: ".$items_suc_added.", error: ".$items_err_added."\n"; - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->arr_global_diff_exc as $ip => $value) { - - $index = $arr_objects_dev_dwn["$ip"]; - $index2 = $arr_objects_dev_upl["$ip"]; - - //echo " deleted: ".$ip.", v1: $index, v2: $index2 \n"; - - $del = $this->conn->remove("/ip/firewall/mangle", array("$index","$index2") ); - - if( $del == "1" ) - { - if($debug > 0){ echo " Item(s) successfully deleted (".$index.",".$index2.")\n"; } - $items_suc_del++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - } //end of foreach $arr_global_diff_mis - - print " count of deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - -} //end of function synchro_mangle - -function qt_global() { - - //zjisteni agregace SC - $rs_agreg = $conn_mysql->query("SELECT agregace, speed_dwn, speed_upl FROM tarify_int WHERE id_tarifu = '1'"); - - while( $d_agreg = mysql_fetch_array($rs_agreg) ) - { - $this->agregace_sc = $d_agreg["agregace"]; - $this->speed_sc_dwn = $d_agreg["speed_dwn"]; - $this->speed_sc_upl = $d_agreg["speed_upl"]; - } - - foreach ($this->objects as $ip => $linka) { - - if($linka == 1) { - $this->objects_sc[] = $ip; - } elseif($linka == 0) { - $this->objects_mp[] = $ip; - } - - //ehm zde garanti este - - else - { - echo " WARNING: Neznámá linka (".$linka.") u objektu: ".$ip."\n"; - } - } - - echo " qt(global) number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - -} - -function qt_delete_all(){ - - $qt_suc_del=0; - $qt_err_del=0; - - $qt_del_all = $this->conn->getall(array("queue","tree")); - - foreach ($qt_del_all as $key => $value) { - - $qt_del_all_id[] = $qt_del_all[$key][".id"]; - - } - - $qt_del = $this->conn->remove("/queue/tree", $qt_del_all_id ); - - if( $qt_del == "1" ) { - if($this->debug > 0){ echo " QT Item(s) successfully deleted (".count($qt_del_all_id).")\n"; } - $qt_suc_del++; - } - else { - if($this->debug > 0){ echo " QT ERROR: ".print_r($qt_del_all_id)."\n"; } - $qt_err_del++; - } - - print " qt: deleted items ".count($qt_del_all_id).", ok: ".$qt_suc_del.", error: ".$qt_err_del."\n"; - - // print_r($qt_del_all_id); - -} - -function detect_diff_queues() { - - //1. zjistime co je v zarizeni - //$qt_dump = $this->conn->getall( array("queue","tree"), "", "", ".id" ); - $qt_dump = $this->conn->getall( array("queue","tree")); - - // print_r($qt_dump); - $qt_dump_trim = $qt_dump; - - //vymazeme .id, jinak nelze pole porovnat - foreach ($qt_dump_trim as $key => $value) { - - unset($qt_dump_trim["$key"][".id"]); - - } //end of foreach qt_dump_trim - - //2. zjistime, co je v adminatoru - - // - // 2.1 SmallCity Linky - // - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - -/* - //muster - [name] => q-dwn-sc-1 - [parent] => global-out - [limit-at] => 2252800 - [priority] => 1 - [max-limit] => 2252800 - [burst-limit] => 0 - [burst-threshold] => 0 - [burst-time] => 00:00:00 - [invalid] => false - [disabled] => false -*/ - - //2.1.1 - agregacni SC tridy - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false"); - } - - //2.1.2 - jednotlive IP adresy - - $qt_system[] = array ("name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "packet-mark" => $ip."_dwn", - "limit-at" => $limit_at_sc_dwn, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_dwn)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "packet-mark" => $ip."_upl", - "limit-at" => $limit_at_sc_upl, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_upl)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } //end of foreach array objects_sc - - // - // 2.2 - MP linky - // - - // - // 2.3 - Garanti - // - - - // - // 3. porovname pole - // - - print_r($qt_dump_trim); - print_r($qt_system); - -/* - if( (count($qt_dump_trim) != count($qt_system) )) - { - echo " qt - does not match the number of elements - forcing rewrite .."; - - $this->synchro_qt_force(); - } - else - { - echo " qt check excess records -- \n"; - - foreach ($qt_dump_trim as $id => $arr_values) { - - $arr2 = array(0); - $arr2 = $qt_system["$id"]; - - $arr_tmp_exc = array_diff($arr_values, $arr2); - - if( (count($arr_tmp_exc) > 0) ) - { - $arr_qt_dev_exc[] = $id; - print_r($arr_tmp_exc); - } - - } //end of foreach $qt_dump_trim - - echo " qt check missing records -- \n"; - - foreach ($qt_system as $id => $arr_values) { - - $arr_tmp_miss = array_diff($arr_values, $qt_dump_trim["$id"]); - - if( (count($arr_tmp_miss) > 0) ) - { - $arr_qt_dev_miss[] = $id; - print_r($arr_tmp_miss); - } - - - } //end of foreach - - //$arr_qt_dev_exc = $this->multidimensional_array_diff($qt_dump_trim, $qt_system); - - //$arr_qt_dev_exc = array_diff($qt_dump_trim, $qt_system); - //print_r($arr_qt_dev_exc); - - //$arr_qt_dev_miss = $this->multidimensional_array_diff($qt_system, $qt_dump_trim); - - //$arr_qt_dev_miss = array_diff($qt_system, $qt_dump_trim); - //print_r($arr_qt_dev_miss); - - echo " qt: number of records : excess: ".count($arr_qt_dev_exc).", missing: ".count($arr_qt_dev_miss)."\n"; - - } //end of else -*/ - -} //end of function datect_diff_queues - -function synchro_qt_force() -{ - - echo " qt - force rewriting ... \n"; - $this->qt_delete_all(); - - echo " tarif info: SmallCity: agregace: ".$this->agregace_sc.", speed dwn: ".$this->speed_sc_dwn."k, upl: ".$this->speed_sc_upl."k \n"; - - echo " qt number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - $qt_ip_suc_added=0; - $qt_ip_err_added=0; - - //muster queues pro SC - ///queue tree - //add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1024k max-limit=1024k name=\ - // q-dwn-sc-1 parent=global-in priority=1 - - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_items_suc_added=0; - $qt_items_err_added=0; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - - print " add QT Group Sc No. ".$sc_group.", items ok: ".$qt_items_suc_added.", error: ".$qt_items_err_added."\n"; - - } - - // add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=1024k name=\ - // q-dwn-sc-10.2.2.2.2 packet-mark=10.52.5.14_dwn parent=q-dwn-sc-1 priority=1 queue=\ - // wireless-default - - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_dwn, "max-limit" => (($this->speed_sc_dwn)*1000), - "name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_upl, "max-limit" => (($this->speed_sc_upl)*1000), - "name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } - - print " qt: count of added items: ok: ".$qt_ip_suc_added.", error: ".$qt_ip_err_added."\n"; - - // - // MP linky - // - $qt_mp_items_suc_added=0; - $qt_mp_items_err_added=0; - - //globalni tridy pro MP - - $add_qt_mp_global_data = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-dwn-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global = $this->conn->add("/queue/tree", $add_qt_mp_global_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_mp_global_data2 = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-upl-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global2 = $this->conn->add("/queue/tree", $add_qt_mp_global_data2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global2)."\n"; } - $qt_mp_items_err_added++; - } - - foreach ($this->objects_mp as $key => $ip) { - - $add_qt_data_mp = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_mp = $this->conn->add("/queue/tree", $add_qt_data_mp); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_data_mp2 = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_mp2 = $this->conn->add("/queue/tree", $add_qt_data_mp2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp2)."\n"; } - $qt_mp_items_err_added++; - } - - } - - print " qt: number of records with MP: added items: ok: ".$qt_mp_items_suc_added.", error: ".$qt_mp_items_err_added."\n"; - -} //end of function synchro_qt_force - - -} //end of class mk_synchro_qos - - - -?> diff --git a/adminator2/mk_control/testing/2011-03-11/ros_api_simelon_test.php b/adminator2/mk_control/testing/2011-03-11/ros_api_simelon_test.php deleted file mode 100644 index 73bb89e6f..000000000 --- a/adminator2/mk_control/testing/2011-03-11/ros_api_simelon_test.php +++ /dev/null @@ -1,1065 +0,0 @@ -query("SELECT id_tarifu, zkratka_tarifu, speed_dwn, speed_upl - FROM tarify_int - WHERE (typ_tarifu = '0' AND garant = '1') - ORDER BY id_tarifu"); - - while($data = mysql_fetch_array($q)) - { - $id = "objects_g_".$data["id_tarifu"]; - $this->objects_garants[$id] = $data["speed_dwn"].":".$data["speed_upl"]; - } - - } //end of function contsruct - -function array_obj_diff ($array1, $array2) { - - foreach ($array1 as $key => $value) { - $array1[$key] = serialize ($value); - } - - foreach ($array2 as $key => $value) { - $array2[$key] = serialize ($value); - } - - $array_diff = array_diff ($array1, $array2); - - foreach ($array_diff as $key => $value) { - $array_diff[$key] = unserialize ($value); - } - - return $array_diff; -} - -//array_obj_diff ($ao1, $ao2); - - function multidimensional_array_diff($a1,$a2) - { - $r = array(); - - foreach ($a2 as $key => $second) - { - foreach ($a1 as $key => $first) - { - - if (isset($a2[$key])) - { - foreach ($first as $first_value) - { - foreach ($second as $second_value) - { - if ($first_value == $second_value) - { - $true = true; - break; - } - } - if (!isset($true)) - { - - $r[$key][] = $first_value; - } - unset($true); - } - } - else - { - $r[$key] = $first; - } - } - } - - return $r; - - } //end of function multidimensional array diff - - function find_root_router($id_routeru, $ip_adresa_routeru) - { - $rs = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$id_routeru'"); - - while( $d = mysql_fetch_array($rs) ) - { $parent_router = $d["parent_router"]; } - - $rs2 = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$parent_router'"); - - while( $d2 = mysql_fetch_array($rs2) ) - { $ip_adresa_2 = $d2["ip_adresa"]; } - - if($ip_adresa_2 == $ip_adresa_routeru) - { //dosahlo se reinhard-fiber, tj. zaznam CHCEME - return true; - } - elseif($parent_router == "0") - { //dosahlo se reinhard-wifi, takze zaznam nechceme - } - else - { //ani jedno predchozi, rekurze .. :) - if( $this->find_root_router($parent_router, $ip_adresa_routeru) == true) - { return true; } - } - - } //end of function find_root_router - - function find_obj($ip) - { - - //1. zjistit routery co jedou pres reinhard-fiber - $rs_routers = $conn_mysql->query("SELECT id, parent_router, nazev, ip_adresa FROM router_list ORDER BY id"); - $num_rs_routers = mysql_num_rows($rs_routers); - - while($data_routers = mysql_fetch_array($rs_routers)) - { - $id_routeru = $data_routers["id"]; - $ip_adresa = $data_routers["ip_adresa"]; - - if( $this->find_root_router($id_routeru,$ip) === true) - { - $routers[] = $id_routeru; - $routers_ip[] = $ip_adresa; - } - } - - //2. zjistit nody - $i=0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if($i == 0) - { $sql_where .= "'$id_routeru'"; } - else - { $sql_where .= ",'$id_routeru'"; } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - //print $sql."\n"; - - $rs_nods = $conn_mysql->query($sql); - $num_rs_nods = mysql_num_rows($rs_nods); - - while($data_nods = mysql_fetch_array($rs_nods)) - { $nods[] = $data_nods["id"]; } - - //3. zjistit lidi - $i=0; - - foreach ($nods as $key => $id_nodu ){ - //print "nods: ".$id_nodu." \n"; - - if($i == 0) - { $sql_obj_where .= "'$id_nodu'"; } - else - { $sql_obj_where .= ",'$id_nodu'"; } - - $i++; - } - - $sql_obj = "SELECT ip, id_tarifu, dns_jmeno FROM objekty WHERE id_nodu IN (".$sql_obj_where.") ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $rs_objects = pg_query($sql_obj); - $num_rs_objects = pg_num_rows($rs_objects); - - while( $data = pg_fetch_array($rs_objects)) - { - $ip = $data["ip"]; - $this->objects[$ip] = $data["id_tarifu"]; - } - - //k seznamu ip adres pridame routery, jak chtej inet :) - foreach ($routers_ip as $key => $ip) { - - //zjistit zda uz IP adresa neni v objektu - if ( (array_key_exists($ip, $this->objects)) ) - { - //echo " object ".$ip." exists \n"; - } - else - { - $this->objects[$ip] = $this->id_tarifu_routers; - } - - } - - print " number of IP addresses via this router: ".$num_rs_objects; - if($this->debug == 1){ echo ", count of array objects: ".count($this->objects)." "; } - echo "\n"; - - } //end of function - - function remove_wrong_items($wrong_items) - { - $item_del_ok=0; - $item_del_err=0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/mangle", $wrong_items); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; } - $item_del_ok = count($wrong_items); - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - function detect_diff_in_mangle() - { - - $this->getall_mangle = $this->conn->getall(array("ip", "firewall", "mangle") ); - -/* - if( count($this->getall_mangle) > 0 ) { - print_r($this->getall_mangle); } - else { - echo " Array \"getall_mangle\" is empty \n"; } -*/ - - //priprava zaznamu v routeru - foreach ($this->getall_mangle as $key => $value) { - - $ip_dwn = $this->getall_mangle["$key"]["$this->element_name_dwn"]; - $ip_upl = $this->getall_mangle["$key"]["$this->element_name_upl"]; - - if( isset($this->getall_mangle[$key]["$this->element_name_dwn"]) ) - { - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_dwn"]."_dwn"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_dwn"] = $this->getall_mangle[$key]["$this->element_name_dwn"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $this->arr_objects_dev_dwn[$ip_dwn] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - - //echo "adding: $ip -- $key\n"; - } - elseif( isset($this->getall_mangle[$key]["$this->element_name_upl"]) ) - { - - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_upl"]."_upl"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_upl"] = $this->getall_mangle[$key]["$this->element_name_upl"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $this->arr_objects_dev_upl[$ip_upl] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - } - else - { - echo " WARNING: Nalezeno jiné pravidlo/nelze parsovat. (id: ".$this->getall_mangle["$key"][".id"].") \n"; - - //zde udelat seznam pravidel pro smazani :) - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - - } //end of else if - } - - if( (count($this->wrong_firewall_items) > 0 ) && ($this->force_mangle_rewrite != 1)) - { $this->remove_wrong_items($this->wrong_firewall_items); } - - //print_r($arr_objects_dev_dwn); - //print_r($arr_objects_dev_upl); - if( !(is_array($this->arr_objects_dev_upl)) ) - { $this->arr_objects_dev_upl = array(); } - - if( !(is_array($this->arr_objects_dev_dwn)) ) - { $this->arr_objects_dev_dwn = array(); } - - $arr_obj_dev_diff = array_diff_key($this->arr_objects_dev_dwn, $this->arr_objects_dev_upl); - //print_r($arr_obj_dev_diff); - - $arr_obj_dev_diff2 = array_diff_key($this->arr_objects_dev_upl, $this->arr_objects_dev_dwn); - //print_r($arr_obj_dev_diff2); - - if( (count($arr_obj_dev_diff) > 0) or ( count($arr_obj_dev_diff2) > 0) ) - { - echo " ERROR: Rozdilny pocet zaznamu pro DWN a UPL. Forcing a full sync... \n"; - $this->force_mangle_rewrite = 1; - } - else - { - echo " number of records : device: ".count($this->arr_objects_dev_dwn).", system: ".count($this->objects)."\n"; - - $this->arr_global_diff_exc = array_diff_key($this->arr_objects_dev_dwn, $this->objects); - $this->arr_global_diff_mis = array_diff_key($this->objects, $this->arr_objects_dev_dwn); - } - -} //end of function detect_diff_in_mangle - -function erase_mangle(){ - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->getall_mangle as $key => $value) { - - /* - if(asi nejake yjimky) - {} - else - */ - { - $erase[] = $this->getall_mangle[$key][".id"]; - //print "erasing id: ".$key."\n"; - } - - } //end of forearch - - $del = $this->conn->remove("/ip/firewall/mangle", $erase); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Item(s) successfully deleted (".count($erase).")\n"; } - $items_suc_del++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - print " count of force deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - //print_r($erase)."\n"; - -} //end of function erase_mangle - -function synchro_mangle_force() -{ - //reseni asi smazat vse a pak pustit synchro_mangle - $this->erase_mangle(); - - $this->detect_diff_in_mangle(); - - $this->synchro_mangle(); - -} //end of function synchro_mangle_force - -function synchro_mangle() -{ - - $items_suc_added = 0; - $items_err_added = 0; - - foreach ($this->arr_global_diff_mis as $ip => $value) { - - $add_par_r = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_dwn", - "$this->item_ip_dwn" => "$ip", "passthrough" => "no"); - $add = $this->conn->add("/ip/firewall/mangle", $add_par_r); - - if( ereg('^\*([[:xdigit:]])*$',$add) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add)."\n"; } - $items_err_added++; - } - - $add_par_r2 = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_upl", - "$this->item_ip_upl" => "$ip", "passthrough" => "no"); - $add2 = $this->conn->add("/ip/firewall/mangle", $add_par_r2); - - if( ereg('^\*([[:xdigit:]])*$',$add2) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add2)."\n"; } - $items_err_added++; - print_r($add_par_r2); - } - - } //end of foreach $arr_global_diff_mis - - print " count of added items: ok: ".$items_suc_added.", error: ".$items_err_added."\n"; - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->arr_global_diff_exc as $ip => $value) { - - $index = $this->arr_objects_dev_dwn["$ip"]; - $index2 = $this->arr_objects_dev_upl["$ip"]; - - //echo " deleted: ".$ip.", v1: $index, v2: $index2 \n"; - - $del = $this->conn->remove("/ip/firewall/mangle", array("$index","$index2") ); - - if( $del == "1" ) - { - if($debug > 0){ echo " Item(s) successfully deleted (".$index.",".$index2.")\n"; } - $items_suc_del++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - } //end of foreach $arr_global_diff_mis - - print " count of deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - -} //end of function synchro_mangle - -function qt_global() { - - //zjisteni agregace SC - $rs_agreg = $conn_mysql->query("SELECT agregace, speed_dwn, speed_upl FROM tarify_int WHERE id_tarifu = '1'"); - - while( $d_agreg = mysql_fetch_array($rs_agreg) ) - { - $this->agregace_sc = $d_agreg["agregace"]; - $this->speed_sc_dwn = $d_agreg["speed_dwn"]; - $this->speed_sc_upl = $d_agreg["speed_upl"]; - } - - foreach ($this->objects as $ip => $linka) { - - if($linka == 1) { - $this->objects_sc[] = $ip; - } - elseif($linka == 0) { - $this->objects_mp[] = $ip; - } - else - { - if(array_key_exists("objects_g_".$linka, $this->objects_garants)) { - //echo " WARNING: garant: "."objects_g_".$linka.", ip> $ip \n"; - $this->{"objects_g_".$linka}[] = $ip; - } - else { - //$this->objects_garants[] - echo " WARNING: Neznámá linka (".$linka.") u objektu: ".$ip."\n"; - } - } - } - - //zredukovat pole objects_garants, dle vyuziti - foreach ($this->objects_garants as $key => $value) { - - if( (count($this->{$key}) > 0 )) { - $this->objects_garants_used[$key] = $value; - } - - } - - //print_r($this->objects_g_2); - //print_r($this->objects_garants_used); - - echo " qt(global) number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - -} - -function qt_delete_all() { - - $qt_suc_del=0; - $qt_err_del=0; - - $qt_del_all = $this->conn->getall(array("queue","tree")); - - foreach ($qt_del_all as $key => $value) { - - $qt_del_all_id[] = $qt_del_all[$key][".id"]; - - } - - $qt_del = $this->conn->remove("/queue/tree", $qt_del_all_id ); - - if( $qt_del == "1" ) { - if($this->debug > 0){ echo " QT Item(s) successfully deleted (".count($qt_del_all_id).")\n"; } - $qt_suc_del++; - } - else { - if($this->debug > 0){ echo " QT ERROR: ".print_r($qt_del_all_id)."\n"; } - $qt_err_del++; - } - - print " qt: deleted items ".count($qt_del_all_id).", ok: ".$qt_suc_del.", error: ".$qt_err_del."\n"; - - // print_r($qt_del_all_id); - -} - -function detect_diff_queues() { - - //1. zjistime co je v zarizeni - //$qt_dump = $this->conn->getall( array("queue","tree"), "", "", ".id" ); - $qt_dump = $this->conn->getall( array("queue","tree")); - - // print_r($qt_dump); - $qt_dump_trim = $qt_dump; - - //vymazeme .id, jinak nelze pole porovnat - foreach ($qt_dump_trim as $key => $value) { - - unset($qt_dump_trim["$key"][".id"]); - - } //end of foreach qt_dump_trim - - //2. zjistime, co je v adminatoru - - // - // 2.1 SmallCity Linky - // - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - -/* - //muster - [name] => q-dwn-sc-1 - [parent] => global-out - [limit-at] => 2252800 - [priority] => 1 - [max-limit] => 2252800 - [burst-limit] => 0 - [burst-threshold] => 0 - [burst-time] => 00:00:00 - [invalid] => false - [disabled] => false -*/ - - //2.1.1 - agregacni SC tridy - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false"); - } - - //2.1.2 - jednotlive IP adresy - - $qt_system[] = array ("name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "packet-mark" => $ip."_dwn", - "limit-at" => $limit_at_sc_dwn, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_dwn)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "packet-mark" => $ip."_upl", - "limit-at" => $limit_at_sc_upl, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_upl)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } //end of foreach array objects_sc - - // - // 2.2 - MP linky - // - - // - // 2.3 - Garanti - // - - - // - // 3. porovname pole - // - - print_r($qt_dump_trim); - print_r($qt_system); - -/* - if( (count($qt_dump_trim) != count($qt_system) )) - { - echo " qt - does not match the number of elements - forcing rewrite .."; - - $this->synchro_qt_force(); - } - else - { - echo " qt check excess records -- \n"; - - foreach ($qt_dump_trim as $id => $arr_values) { - - $arr2 = array(0); - $arr2 = $qt_system["$id"]; - - $arr_tmp_exc = array_diff($arr_values, $arr2); - - if( (count($arr_tmp_exc) > 0) ) - { - $arr_qt_dev_exc[] = $id; - print_r($arr_tmp_exc); - } - - } //end of foreach $qt_dump_trim - - echo " qt check missing records -- \n"; - - foreach ($qt_system as $id => $arr_values) { - - $arr_tmp_miss = array_diff($arr_values, $qt_dump_trim["$id"]); - - if( (count($arr_tmp_miss) > 0) ) - { - $arr_qt_dev_miss[] = $id; - print_r($arr_tmp_miss); - } - - - } //end of foreach - - //$arr_qt_dev_exc = $this->multidimensional_array_diff($qt_dump_trim, $qt_system); - - //$arr_qt_dev_exc = array_diff($qt_dump_trim, $qt_system); - //print_r($arr_qt_dev_exc); - - //$arr_qt_dev_miss = $this->multidimensional_array_diff($qt_system, $qt_dump_trim); - - //$arr_qt_dev_miss = array_diff($qt_system, $qt_dump_trim); - //print_r($arr_qt_dev_miss); - - echo " qt: number of records : excess: ".count($arr_qt_dev_exc).", missing: ".count($arr_qt_dev_miss)."\n"; - - } //end of else -*/ - -} //end of function datect_diff_queues - -function synchro_qt_force() -{ - - //for testing, erasing arrays - $this->objects_sc = array(); - $this->objects_mp = array(); - - echo " qt - force rewriting ... \n"; - $this->qt_delete_all(); - - echo " tarif info: SmallCity: agregace: ".$this->agregace_sc.", speed dwn: ".$this->speed_sc_dwn."k, upl: ".$this->speed_sc_upl."k \n"; - - echo " qt number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - echo " qt number of records tariff: garants: ".count($this->objects_garants_used)."\n"; - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - $qt_ip_suc_added=0; - $qt_ip_err_added=0; - - //muster queues pro SC - ///queue tree - //add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1024k max-limit=1024k name=\ - // q-dwn-sc-1 parent=global-in priority=1 - - // - // QT - SMallCity - // - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_items_suc_added=0; - $qt_items_err_added=0; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - - print " add QT Group Sc No. ".$sc_group.", items ok: ".$qt_items_suc_added.", error: ".$qt_items_err_added."\n"; - - } - - // add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=1024k name=\ - // q-dwn-sc-10.2.2.2.2 packet-mark=10.52.5.14_dwn parent=q-dwn-sc-1 priority=1 queue=\ - // wireless-default - - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_dwn, "max-limit" => (($this->speed_sc_dwn)*1000), - "name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_upl, "max-limit" => (($this->speed_sc_upl)*1000), - "name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } - - print " qt: count of added items: ok: ".$qt_ip_suc_added.", error: ".$qt_ip_err_added."\n"; - - // - // QT Force - MP linky - // - $qt_mp_items_suc_added=0; - $qt_mp_items_err_added=0; - - //globalni tridy pro MP - - $add_qt_mp_global_data = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-dwn-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global = $this->conn->add("/queue/tree", $add_qt_mp_global_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_mp_global_data2 = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-upl-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global2 = $this->conn->add("/queue/tree", $add_qt_mp_global_data2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global2)."\n"; } - $qt_mp_items_err_added++; - } - - foreach ($this->objects_mp as $key => $ip) { - - $add_qt_data_mp = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_mp = $this->conn->add("/queue/tree", $add_qt_data_mp); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_data_mp2 = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_mp2 = $this->conn->add("/queue/tree", $add_qt_data_mp2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp2)."\n"; } - $qt_mp_items_err_added++; - } - - } - - print " qt: number of records with MP: added items: ok: ".$qt_mp_items_suc_added.", error: ".$qt_mp_items_err_added."\n"; - - // - // QT Force - Garanty - // - $qt_g_items_suc_added = 0; - $qt_g_items_err_added = 0; - - foreach( $this->objects_garants_used as $garant_id => $speeds) - { - list($speed_dwn, $speed_upl) = explode(":",$speeds); - - print " qt-force :: garants :: ".$garant_id.", speed_dwn: ".$speed_dwn.", speed_upl: ".$speed_upl."\n"; - - $add_qt_data_g = array ("disabled" => "false", "limit-at" => $speed_dwn."k", "max-limit" => $speed_dwn."k", - "name" => "q-dwn-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g = $this->conn->add("/queue/tree", $add_qt_data_g); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g) ) - { - if($this->debug > 0){ echo " QT Item (garant parent dwn) ".$add_qt_g." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q)."\n"; } - $qt_g_items_err_added++; - } - - $add_qt_data_g2 = array ("disabled" => "false", "limit-at" => $speed_upl."k", "max-limit" => $speed_upl."k", - "name" => "q-upl-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g2 = $this->conn->add("/queue/tree", $add_qt_data_g2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g2) ) - { - if($this->debug > 0){ echo " QT Item (garant parent upl) ".$add_qt_g2." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q2)."\n"; } - $qt_g_items_err_added++; - } - - foreach( $this->{$garant_id} as $id => $ip) - { - - $add_qt_data_g_dwn = array ("disabled" => "false", "name" => "q-dwn-q-".$ip, "parent" => "q-dwn-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_g_dwn = $this->conn->add("/queue/tree", $add_qt_data_g_dwn); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g_dwn) ) - { - if($this->debug > 0){ echo " QT Item (garant ".$ip." dwn) ".$add_qt_g_dwn." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q_dwn)."\n"; } - $qt_g_items_err_added++; - } - - $add_qt_data_g_upl = array ("disabled" => "false", "name" => "q-upl-q-".$ip, "parent" => "q-upl-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_g_upl = $this->conn->add("/queue/tree", $add_qt_data_g_upl); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g_upl) ) - { - if($this->debug > 0){ echo " QT Item (garant ".$ip." upl) ".$add_qt_g_upl." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q2)."\n"; } - $qt_g_items_err_added++; - } - - - } //end of FOREACH $this->{$garant_id} - - } //end of FOREACH objects_garants_used - - print " qt: number of records with GARANT: added items: ok: ".$qt_g_items_suc_added.", error: ".$qt_g_items_err_added."\n"; - -} //end of function synchro_qt_force - - -} //end of class mk_synchro_qos - - - -?> diff --git a/adminator2/mk_control/testing/2011-03-15-plus-client-ap-ip/mk_qos_handler_test.php b/adminator2/mk_control/testing/2011-03-15-plus-client-ap-ip/mk_qos_handler_test.php deleted file mode 100644 index c587c7023..000000000 --- a/adminator2/mk_control/testing/2011-03-15-plus-client-ap-ip/mk_qos_handler_test.php +++ /dev/null @@ -1,101 +0,0 @@ -debug=$debug; -$mk_qos->conn=$conn; - -$mk_qos->element_name_dwn=$element_name_dwn; -$mk_qos->element_name_upl=$element_name_upl; - -$mk_qos->item_ip_dwn=$item_ip_dwn; -$mk_qos->item_ip_upl=$item_ip_upl; - -$mk_qos->chain=$chain; - -$mk_qos->find_obj("10.128.0.3"); - -$mk_qos->sc_speed_koef=$sc_speed_koef; - - // - //reseni firewall/mangle - // - - $mk_qos->detect_diff_in_mangle(); - - if($mk_qos->force_mangle_rewrite == 1){ - $mk_qos->synchro_mangle_force(); - } - else - { - print " counts excess ip: ".count($mk_qos->arr_global_diff_exc).", missing ip: ".count($mk_qos->arr_global_diff_mis)."\n"; - $mk_qos->synchro_mangle(); - } - - // - // reseni queue(s) - // - - - $mk_qos->qt_global(); - - //$mk_qos->detect_diff_queues(); - $mk_qos->synchro_qt_force(); - - -?> diff --git a/adminator2/mk_control/testing/2011-03-15-plus-client-ap-ip/ros_api_simelon_test.php b/adminator2/mk_control/testing/2011-03-15-plus-client-ap-ip/ros_api_simelon_test.php deleted file mode 100644 index 31abd7c61..000000000 --- a/adminator2/mk_control/testing/2011-03-15-plus-client-ap-ip/ros_api_simelon_test.php +++ /dev/null @@ -1,1072 +0,0 @@ -query("SELECT id_tarifu, zkratka_tarifu, speed_dwn, speed_upl - FROM tarify_int - WHERE (typ_tarifu = '0' AND garant = '1') - ORDER BY id_tarifu"); - - while($data = mysql_fetch_array($q)) - { - $id = "objects_g_".$data["id_tarifu"]; - $this->objects_garants[$id] = $data["speed_dwn"].":".$data["speed_upl"]; - } - - } //end of function contsruct - -function array_obj_diff ($array1, $array2) { - - foreach ($array1 as $key => $value) { - $array1[$key] = serialize ($value); - } - - foreach ($array2 as $key => $value) { - $array2[$key] = serialize ($value); - } - - $array_diff = array_diff ($array1, $array2); - - foreach ($array_diff as $key => $value) { - $array_diff[$key] = unserialize ($value); - } - - return $array_diff; -} - -//array_obj_diff ($ao1, $ao2); - - function multidimensional_array_diff($a1,$a2) - { - $r = array(); - - foreach ($a2 as $key => $second) - { - foreach ($a1 as $key => $first) - { - - if (isset($a2[$key])) - { - foreach ($first as $first_value) - { - foreach ($second as $second_value) - { - if ($first_value == $second_value) - { - $true = true; - break; - } - } - if (!isset($true)) - { - - $r[$key][] = $first_value; - } - unset($true); - } - } - else - { - $r[$key] = $first; - } - } - } - - return $r; - - } //end of function multidimensional array diff - - function find_root_router($id_routeru, $ip_adresa_routeru) - { - $rs = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$id_routeru'"); - - while( $d = mysql_fetch_array($rs) ) - { $parent_router = $d["parent_router"]; } - - $rs2 = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$parent_router'"); - - while( $d2 = mysql_fetch_array($rs2) ) - { $ip_adresa_2 = $d2["ip_adresa"]; } - - if($ip_adresa_2 == $ip_adresa_routeru) - { //dosahlo se reinhard-fiber, tj. zaznam CHCEME - return true; - } - elseif($parent_router == "0") - { //dosahlo se reinhard-wifi, takze zaznam nechceme - } - else - { //ani jedno predchozi, rekurze .. :) - if( $this->find_root_router($parent_router, $ip_adresa_routeru) == true) - { return true; } - } - - } //end of function find_root_router - - function find_obj($ip) - { - - //1. zjistit routery co jedou pres reinhard-fiber - $rs_routers = $conn_mysql->query("SELECT id, parent_router, nazev, ip_adresa FROM router_list ORDER BY id"); - $num_rs_routers = mysql_num_rows($rs_routers); - - while($data_routers = mysql_fetch_array($rs_routers)) - { - $id_routeru = $data_routers["id"]; - $ip_adresa = $data_routers["ip_adresa"]; - - if( $this->find_root_router($id_routeru,$ip) === true) - { - $routers[] = $id_routeru; - $routers_ip[] = $ip_adresa; - } - } - - //2. zjistit nody - $i=0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if($i == 0) - { $sql_where .= "'$id_routeru'"; } - else - { $sql_where .= ",'$id_routeru'"; } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - //print $sql."\n"; - - $rs_nods = $conn_mysql->query($sql); - $num_rs_nods = mysql_num_rows($rs_nods); - - while($data_nods = mysql_fetch_array($rs_nods)) - { $nods[] = $data_nods["id"]; } - - //3. zjistit lidi - $i=0; - - foreach($nods as $key => $id_nodu ){ - //print "nods: ".$id_nodu." \n"; - - if($i == 0) - { $sql_obj_where .= "'$id_nodu'"; } - else - { $sql_obj_where .= ",'$id_nodu'"; } - - $i++; - } - - $sql_obj = "SELECT ip, id_tarifu, client_ap_ip FROM objekty WHERE id_nodu IN (".$sql_obj_where.") ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $rs_objects = pg_query($sql_obj); - $num_rs_objects = pg_num_rows($rs_objects); - - while( $data = pg_fetch_array($rs_objects)) - { - $ip = $data["ip"]; - $client_ap_ip = $data["client_ap_ip"]; - - $this->objects[$ip] = $data["id_tarifu"]; - - if( (strlen($client_ap_ip) > 4) ) - { //vyplnena ip adresa apcka - - //zjistit zda-li uz neni - if( !(array_key_exists($client_ap_ip, $this->objects)) ) - { $this->objects[$client_ap_ip] = $this->id_tarifu_routers; } - } - } - - //k seznamu ip adres pridame routery, taky chtej inet :) - foreach($routers_ip as $key => $ip) { - - //zjistit zda uz IP adresa neni v objektu - if( (array_key_exists($ip, $this->objects)) ) - { /* echo " object ".$ip." exists \n"; */ } - else - { $this->objects[$ip] = $this->id_tarifu_routers; } - - } - - print " number of IP addresses via this router: ".count($objects).". \n"; - - if($this->debug == 1){ echo ", count of array objects: ".count($this->objects)." "; } - echo "\n"; - - } //end of function - - function remove_wrong_items($wrong_items) - { - $item_del_ok=0; - $item_del_err=0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/mangle", $wrong_items); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; } - $item_del_ok = count($wrong_items); - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - function detect_diff_in_mangle() - { - - $this->getall_mangle = $this->conn->getall(array("ip", "firewall", "mangle") ); - -/* - if( count($this->getall_mangle) > 0 ) { - print_r($this->getall_mangle); } - else { - echo " Array \"getall_mangle\" is empty \n"; } -*/ - - //priprava zaznamu v routeru - foreach ($this->getall_mangle as $key => $value) { - - $ip_dwn = $this->getall_mangle["$key"]["$this->element_name_dwn"]; - $ip_upl = $this->getall_mangle["$key"]["$this->element_name_upl"]; - - if( isset($this->getall_mangle[$key]["$this->element_name_dwn"]) ) - { - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_dwn"]."_dwn"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_dwn"] = $this->getall_mangle[$key]["$this->element_name_dwn"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $this->arr_objects_dev_dwn[$ip_dwn] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - - //echo "adding: $ip -- $key\n"; - } - elseif( isset($this->getall_mangle[$key]["$this->element_name_upl"]) ) - { - - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_upl"]."_upl"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_upl"] = $this->getall_mangle[$key]["$this->element_name_upl"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $this->arr_objects_dev_upl[$ip_upl] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - } - else - { - echo " WARNING: Nalezeno jiné pravidlo/nelze parsovat. (id: ".$this->getall_mangle["$key"][".id"].") \n"; - - //zde udelat seznam pravidel pro smazani :) - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - - } //end of else if - } - - if( (count($this->wrong_firewall_items) > 0 ) && ($this->force_mangle_rewrite != 1)) - { $this->remove_wrong_items($this->wrong_firewall_items); } - - //print_r($arr_objects_dev_dwn); - //print_r($arr_objects_dev_upl); - if( !(is_array($this->arr_objects_dev_upl)) ) - { $this->arr_objects_dev_upl = array(); } - - if( !(is_array($this->arr_objects_dev_dwn)) ) - { $this->arr_objects_dev_dwn = array(); } - - $arr_obj_dev_diff = array_diff_key($this->arr_objects_dev_dwn, $this->arr_objects_dev_upl); - //print_r($arr_obj_dev_diff); - - $arr_obj_dev_diff2 = array_diff_key($this->arr_objects_dev_upl, $this->arr_objects_dev_dwn); - //print_r($arr_obj_dev_diff2); - - if( (count($arr_obj_dev_diff) > 0) or ( count($arr_obj_dev_diff2) > 0) ) - { - echo " ERROR: Rozdilny pocet zaznamu pro DWN a UPL. Forcing a full sync... \n"; - $this->force_mangle_rewrite = 1; - } - else - { - echo " number of records : device: ".count($this->arr_objects_dev_dwn).", system: ".count($this->objects)."\n"; - - $this->arr_global_diff_exc = array_diff_key($this->arr_objects_dev_dwn, $this->objects); - $this->arr_global_diff_mis = array_diff_key($this->objects, $this->arr_objects_dev_dwn); - } - -} //end of function detect_diff_in_mangle - -function erase_mangle(){ - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->getall_mangle as $key => $value) { - - /* - if(asi nejake yjimky) - {} - else - */ - { - $erase[] = $this->getall_mangle[$key][".id"]; - //print "erasing id: ".$key."\n"; - } - - } //end of forearch - - $del = $this->conn->remove("/ip/firewall/mangle", $erase); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Item(s) successfully deleted (".count($erase).")\n"; } - $items_suc_del++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - print " count of force deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - //print_r($erase)."\n"; - -} //end of function erase_mangle - -function synchro_mangle_force() -{ - //reseni asi smazat vse a pak pustit synchro_mangle - $this->erase_mangle(); - - $this->detect_diff_in_mangle(); - - $this->synchro_mangle(); - -} //end of function synchro_mangle_force - -function synchro_mangle() -{ - - $items_suc_added = 0; - $items_err_added = 0; - - foreach ($this->arr_global_diff_mis as $ip => $value) { - - $add_par_r = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_dwn", - "$this->item_ip_dwn" => "$ip", "passthrough" => "no"); - $add = $this->conn->add("/ip/firewall/mangle", $add_par_r); - - if( ereg('^\*([[:xdigit:]])*$',$add) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add)."\n"; } - $items_err_added++; - } - - $add_par_r2 = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_upl", - "$this->item_ip_upl" => "$ip", "passthrough" => "no"); - $add2 = $this->conn->add("/ip/firewall/mangle", $add_par_r2); - - if( ereg('^\*([[:xdigit:]])*$',$add2) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add2)."\n"; } - $items_err_added++; - print_r($add_par_r2); - } - - } //end of foreach $arr_global_diff_mis - - print " count of added items: ok: ".$items_suc_added.", error: ".$items_err_added."\n"; - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->arr_global_diff_exc as $ip => $value) { - - $index = $this->arr_objects_dev_dwn["$ip"]; - $index2 = $this->arr_objects_dev_upl["$ip"]; - - //echo " deleted: ".$ip.", v1: $index, v2: $index2 \n"; - - $del = $this->conn->remove("/ip/firewall/mangle", array("$index","$index2") ); - - if( $del == "1" ) - { - if($debug > 0){ echo " Item(s) successfully deleted (".$index.",".$index2.")\n"; } - $items_suc_del++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - } //end of foreach $arr_global_diff_mis - - print " count of deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - -} //end of function synchro_mangle - -function qt_global() { - - //zjisteni agregace SC - $rs_agreg = $conn_mysql->query("SELECT agregace, speed_dwn, speed_upl FROM tarify_int WHERE id_tarifu = '1'"); - - while( $d_agreg = mysql_fetch_array($rs_agreg) ) - { - $this->agregace_sc = $d_agreg["agregace"]; - $this->speed_sc_dwn = $d_agreg["speed_dwn"]; - $this->speed_sc_upl = $d_agreg["speed_upl"]; - } - - foreach ($this->objects as $ip => $linka) { - - if($linka == 1) { - $this->objects_sc[] = $ip; - } - elseif($linka == 0) { - $this->objects_mp[] = $ip; - } - else - { - if(array_key_exists("objects_g_".$linka, $this->objects_garants)) { - //echo " WARNING: garant: "."objects_g_".$linka.", ip> $ip \n"; - $this->{"objects_g_".$linka}[] = $ip; - } - else { - //$this->objects_garants[] - echo " WARNING: Neznámá linka (".$linka.") u objektu: ".$ip."\n"; - } - } - } - - //zredukovat pole objects_garants, dle vyuziti - foreach ($this->objects_garants as $key => $value) { - - if( (count($this->{$key}) > 0 )) { - $this->objects_garants_used[$key] = $value; - } - - } - - //print_r($this->objects_g_2); - //print_r($this->objects_garants_used); - - echo " qt(global) number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - -} - -function qt_delete_all() { - - $qt_suc_del=0; - $qt_err_del=0; - - $qt_del_all = $this->conn->getall(array("queue","tree")); - - foreach ($qt_del_all as $key => $value) { - - $qt_del_all_id[] = $qt_del_all[$key][".id"]; - - } - - $qt_del = $this->conn->remove("/queue/tree", $qt_del_all_id ); - - if( $qt_del == "1" ) { - if($this->debug > 0){ echo " QT Item(s) successfully deleted (".count($qt_del_all_id).")\n"; } - $qt_suc_del++; - } - else { - if($this->debug > 0){ echo " QT ERROR: ".print_r($qt_del_all_id)."\n"; } - $qt_err_del++; - } - - print " qt: deleted items ".count($qt_del_all_id).", ok: ".$qt_suc_del.", error: ".$qt_err_del."\n"; - - // print_r($qt_del_all_id); - -} - -function detect_diff_queues() { - - //1. zjistime co je v zarizeni - //$qt_dump = $this->conn->getall( array("queue","tree"), "", "", ".id" ); - $qt_dump = $this->conn->getall( array("queue","tree")); - - // print_r($qt_dump); - $qt_dump_trim = $qt_dump; - - //vymazeme .id, jinak nelze pole porovnat - foreach ($qt_dump_trim as $key => $value) { - - unset($qt_dump_trim["$key"][".id"]); - - } //end of foreach qt_dump_trim - - //2. zjistime, co je v adminatoru - - // - // 2.1 SmallCity Linky - // - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - -/* - //muster - [name] => q-dwn-sc-1 - [parent] => global-out - [limit-at] => 2252800 - [priority] => 1 - [max-limit] => 2252800 - [burst-limit] => 0 - [burst-threshold] => 0 - [burst-time] => 00:00:00 - [invalid] => false - [disabled] => false -*/ - - //2.1.1 - agregacni SC tridy - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false"); - } - - //2.1.2 - jednotlive IP adresy - - $qt_system[] = array ("name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "packet-mark" => $ip."_dwn", - "limit-at" => $limit_at_sc_dwn, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_dwn)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "packet-mark" => $ip."_upl", - "limit-at" => $limit_at_sc_upl, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_upl)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } //end of foreach array objects_sc - - // - // 2.2 - MP linky - // - - // - // 2.3 - Garanti - // - - - // - // 3. porovname pole - // - - print_r($qt_dump_trim); - print_r($qt_system); - -/* - if( (count($qt_dump_trim) != count($qt_system) )) - { - echo " qt - does not match the number of elements - forcing rewrite .."; - - $this->synchro_qt_force(); - } - else - { - echo " qt check excess records -- \n"; - - foreach ($qt_dump_trim as $id => $arr_values) { - - $arr2 = array(0); - $arr2 = $qt_system["$id"]; - - $arr_tmp_exc = array_diff($arr_values, $arr2); - - if( (count($arr_tmp_exc) > 0) ) - { - $arr_qt_dev_exc[] = $id; - print_r($arr_tmp_exc); - } - - } //end of foreach $qt_dump_trim - - echo " qt check missing records -- \n"; - - foreach ($qt_system as $id => $arr_values) { - - $arr_tmp_miss = array_diff($arr_values, $qt_dump_trim["$id"]); - - if( (count($arr_tmp_miss) > 0) ) - { - $arr_qt_dev_miss[] = $id; - print_r($arr_tmp_miss); - } - - - } //end of foreach - - //$arr_qt_dev_exc = $this->multidimensional_array_diff($qt_dump_trim, $qt_system); - - //$arr_qt_dev_exc = array_diff($qt_dump_trim, $qt_system); - //print_r($arr_qt_dev_exc); - - //$arr_qt_dev_miss = $this->multidimensional_array_diff($qt_system, $qt_dump_trim); - - //$arr_qt_dev_miss = array_diff($qt_system, $qt_dump_trim); - //print_r($arr_qt_dev_miss); - - echo " qt: number of records : excess: ".count($arr_qt_dev_exc).", missing: ".count($arr_qt_dev_miss)."\n"; - - } //end of else -*/ - -} //end of function datect_diff_queues - -function synchro_qt_force() -{ - - //for testing, erasing arrays - //$this->objects_sc = array(); - //$this->objects_mp = array(); - - echo " qt - force rewriting ... \n"; - $this->qt_delete_all(); - - echo " tarif info: SmallCity: agregace: ".$this->agregace_sc.", speed dwn: ".$this->speed_sc_dwn."k, upl: ".$this->speed_sc_upl."k \n"; - - echo " qt number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - echo " qt number of records tariff: garants: ".count($this->objects_garants_used)."\n"; - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - $qt_ip_suc_added=0; - $qt_ip_err_added=0; - - //muster queues pro SC - ///queue tree - //add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1024k max-limit=1024k name=\ - // q-dwn-sc-1 parent=global-in priority=1 - - // - // QT - SMallCity - // - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_items_suc_added=0; - $qt_items_err_added=0; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - - print " add QT Group Sc No. ".$sc_group.", items ok: ".$qt_items_suc_added.", error: ".$qt_items_err_added."\n"; - - } - - // add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=1024k name=\ - // q-dwn-sc-10.2.2.2.2 packet-mark=10.52.5.14_dwn parent=q-dwn-sc-1 priority=1 queue=\ - // wireless-default - - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_dwn, "max-limit" => (($this->speed_sc_dwn)*1000), - "name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_upl, "max-limit" => (($this->speed_sc_upl)*1000), - "name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } - - print " qt: count of added items: ok: ".$qt_ip_suc_added.", error: ".$qt_ip_err_added."\n"; - - // - // QT Force - MP linky - // - $qt_mp_items_suc_added=0; - $qt_mp_items_err_added=0; - - //globalni tridy pro MP - - $add_qt_mp_global_data = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-dwn-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global = $this->conn->add("/queue/tree", $add_qt_mp_global_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_mp_global_data2 = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-upl-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global2 = $this->conn->add("/queue/tree", $add_qt_mp_global_data2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global2)."\n"; } - $qt_mp_items_err_added++; - } - - foreach ($this->objects_mp as $key => $ip) { - - $add_qt_data_mp = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_mp = $this->conn->add("/queue/tree", $add_qt_data_mp); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_data_mp2 = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_mp2 = $this->conn->add("/queue/tree", $add_qt_data_mp2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp2)."\n"; } - $qt_mp_items_err_added++; - } - - } - - print " qt: number of records with MP: added items: ok: ".$qt_mp_items_suc_added.", error: ".$qt_mp_items_err_added."\n"; - - // - // QT Force - Garanty - // - $qt_g_items_suc_added = 0; - $qt_g_items_err_added = 0; - - foreach( $this->objects_garants_used as $garant_id => $speeds) - { - list($speed_dwn, $speed_upl) = explode(":",$speeds); - - print " qt-force :: garants :: ".$garant_id.", speed_dwn: ".$speed_dwn.", speed_upl: ".$speed_upl."\n"; - - $add_qt_data_g = array ("disabled" => "false", "limit-at" => $speed_dwn."k", "max-limit" => $speed_dwn."k", - "name" => "q-dwn-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g = $this->conn->add("/queue/tree", $add_qt_data_g); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g) ) - { - if($this->debug > 0){ echo " QT Item (garant parent dwn) ".$add_qt_g." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q)."\n"; } - $qt_g_items_err_added++; - } - - $add_qt_data_g2 = array ("disabled" => "false", "limit-at" => $speed_upl."k", "max-limit" => $speed_upl."k", - "name" => "q-upl-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g2 = $this->conn->add("/queue/tree", $add_qt_data_g2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g2) ) - { - if($this->debug > 0){ echo " QT Item (garant parent upl) ".$add_qt_g2." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q2)."\n"; } - $qt_g_items_err_added++; - } - - foreach( $this->{$garant_id} as $id => $ip) - { - - $add_qt_data_g_dwn = array ("disabled" => "false", "name" => "q-dwn-q-".$ip, "parent" => "q-dwn-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_g_dwn = $this->conn->add("/queue/tree", $add_qt_data_g_dwn); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g_dwn) ) - { - if($this->debug > 0){ echo " QT Item (garant ".$ip." dwn) ".$add_qt_g_dwn." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q_dwn)."\n"; } - $qt_g_items_err_added++; - } - - $add_qt_data_g_upl = array ("disabled" => "false", "name" => "q-upl-q-".$ip, "parent" => "q-upl-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_g_upl = $this->conn->add("/queue/tree", $add_qt_data_g_upl); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g_upl) ) - { - if($this->debug > 0){ echo " QT Item (garant ".$ip." upl) ".$add_qt_g_upl." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q2)."\n"; } - $qt_g_items_err_added++; - } - - - } //end of FOREACH $this->{$garant_id} - - } //end of FOREACH objects_garants_used - - print " qt: number of records with GARANT: added items: ok: ".$qt_g_items_suc_added.", error: ".$qt_g_items_err_added."\n"; - -} //end of function synchro_qt_force - - -} //end of class mk_synchro_qos - - - -?> diff --git a/adminator2/mk_control/testing/2011-03-29--diff-QT/mk_qos_handler_test.php b/adminator2/mk_control/testing/2011-03-29--diff-QT/mk_qos_handler_test.php deleted file mode 100644 index 05732cc52..000000000 --- a/adminator2/mk_control/testing/2011-03-29--diff-QT/mk_qos_handler_test.php +++ /dev/null @@ -1,102 +0,0 @@ -debug=$debug; -$mk_qos->conn=$conn; - -$mk_qos->element_name_dwn=$element_name_dwn; -$mk_qos->element_name_upl=$element_name_upl; - -$mk_qos->item_ip_dwn=$item_ip_dwn; -$mk_qos->item_ip_upl=$item_ip_upl; - -$mk_qos->chain=$chain; - -$mk_qos->find_obj("10.128.0.3"); - -$mk_qos->sc_speed_koef=$sc_speed_koef; - - // - //reseni firewall/mangle - // - - $mk_qos->detect_diff_in_mangle(); - - if($mk_qos->force_mangle_rewrite == 1){ - $mk_qos->synchro_mangle_force(); - } - else - { - print " counts excess ip: ".count($mk_qos->arr_global_diff_exc).", missing ip: ".count($mk_qos->arr_global_diff_mis)."\n"; - $mk_qos->synchro_mangle(); - } - - // - // reseni queue(s) - // - - - $mk_qos->qt_global(); - - $mk_qos->detect_diff_queues(); - //$mk_qos->synchro_qt_force(); - - -?> diff --git a/adminator2/mk_control/testing/2011-03-29--diff-QT/ros_api_simelon_test.php b/adminator2/mk_control/testing/2011-03-29--diff-QT/ros_api_simelon_test.php deleted file mode 100644 index 683d55073..000000000 --- a/adminator2/mk_control/testing/2011-03-29--diff-QT/ros_api_simelon_test.php +++ /dev/null @@ -1,1155 +0,0 @@ -query("SELECT id_tarifu, zkratka_tarifu, speed_dwn, speed_upl - FROM tarify_int - WHERE (typ_tarifu = '0' AND garant = '1') - ORDER BY id_tarifu"); - - while($data = mysql_fetch_array($q)) - { - $id = "objects_g_".$data["id_tarifu"]; - $this->objects_garants[$id] = $data["speed_dwn"].":".$data["speed_upl"]; - } - - } //end of function contsruct - - function array_serialize($array) { - - $aReturn = array(); - - foreach ($array as $key => $value) - { - if( isset($value["limit-at"])) - { $value["limit-at"] = floatval($value["limit-at"]); } - - if(isset($value["max-limit"])) - { $value["max-limit"] = floatval($value["max-limit"]); } - - $serValue = serialize($value); - - $aReturn[$key] = $serValue; - } - - return $aReturn; - - } //end of function array_serialize - - - function arrayDiff($aArray1, $aArray2) { - - //priprava promenych - $aReturn = array(); - - $serArray1 = $this->array_serialize($aArray1); - $serArray2 = $this->array_serialize($aArray2); - - $diffArray = array_diff($serArray1,$serArray2); - -// echo "--- serArray1 --- \n".print_r($serArray1); -// echo "--- diffArray --- \n".print_r($diffArray)." \n"; - - foreach($diffArray as $key => $value) - { $aReturn[$key] = ""; } - - return $aReturn; - - } //end of function arrayRecursiveDiff - - function find_root_router($id_routeru, $ip_adresa_routeru) - { - $rs = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$id_routeru'"); - - while( $d = mysql_fetch_array($rs) ) - { $parent_router = $d["parent_router"]; } - - $rs2 = $conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$parent_router'"); - - while( $d2 = mysql_fetch_array($rs2) ) - { $ip_adresa_2 = $d2["ip_adresa"]; } - - if($ip_adresa_2 == $ip_adresa_routeru) - { //dosahlo se reinhard-fiber, tj. zaznam CHCEME - return true; - } - elseif($parent_router == "0") - { //dosahlo se reinhard-wifi, takze zaznam nechceme - } - else - { //ani jedno predchozi, rekurze .. :) - if( $this->find_root_router($parent_router, $ip_adresa_routeru) == true) - { return true; } - } - - } //end of function find_root_router - - function find_obj($ip) - { - - //1. zjistit routery co jedou pres reinhard-fiber - $rs_routers = $conn_mysql->query("SELECT id, parent_router, nazev, ip_adresa FROM router_list ORDER BY id"); - $num_rs_routers = mysql_num_rows($rs_routers); - - while($data_routers = mysql_fetch_array($rs_routers)) - { - $id_routeru = $data_routers["id"]; - $ip_adresa = $data_routers["ip_adresa"]; - - if( $this->find_root_router($id_routeru,$ip) === true) - { - $routers[] = $id_routeru; - $routers_ip[] = $ip_adresa; - } - } - - //2. zjistit nody - $i=0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if($i == 0) - { $sql_where .= "'$id_routeru'"; } - else - { $sql_where .= ",'$id_routeru'"; } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - //print $sql."\n"; - - $rs_nods = $conn_mysql->query($sql); - $num_rs_nods = mysql_num_rows($rs_nods); - - while($data_nods = mysql_fetch_array($rs_nods)) - { $nods[] = $data_nods["id"]; } - - //3. zjistit lidi - $i=0; - - foreach($nods as $key => $id_nodu ){ - //print "nods: ".$id_nodu." \n"; - - if($i == 0) - { $sql_obj_where .= "'$id_nodu'"; } - else - { $sql_obj_where .= ",'$id_nodu'"; } - - $i++; - } - - $sql_obj = "SELECT ip, id_tarifu, client_ap_ip FROM objekty WHERE id_nodu IN (".$sql_obj_where.") ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $rs_objects = pg_query($sql_obj); - $num_rs_objects = pg_num_rows($rs_objects); - - while( $data = pg_fetch_array($rs_objects)) - { - $ip = $data["ip"]; - $client_ap_ip = $data["client_ap_ip"]; - - $this->objects[$ip] = $data["id_tarifu"]; - - if( (strlen($client_ap_ip) > 4) ) - { //vyplnena ip adresa apcka - - //zjistit zda-li uz neni - if( !(array_key_exists($client_ap_ip, $this->objects)) ) - { $this->objects[$client_ap_ip] = $this->id_tarifu_routers; } - } - } - - //k seznamu ip adres pridame routery, taky chtej inet :) - foreach($routers_ip as $key => $ip) { - - //zjistit zda uz IP adresa neni v objektu - if( (array_key_exists($ip, $this->objects)) ) - { /* echo " object ".$ip." exists \n"; */ } - else - { $this->objects[$ip] = $this->id_tarifu_routers; } - - } - - print " number of IP addresses via this router: ".count($this->objects); - - if($this->debug == 1){ echo ", count of array objects: ".count($this->objects)." "; } - echo "\n"; - - } //end of function - - function remove_wrong_items($wrong_items) - { - $item_del_ok=0; - $item_del_err=0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/mangle", $wrong_items); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; } - $item_del_ok = count($wrong_items); - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - function detect_diff_in_mangle() - { - - $this->getall_mangle = $this->conn->getall(array("ip", "firewall", "mangle") ); - -/* - if( count($this->getall_mangle) > 0 ) { - print_r($this->getall_mangle); } - else { - echo " Array \"getall_mangle\" is empty \n"; } -*/ - - //priprava zaznamu v routeru - foreach ($this->getall_mangle as $key => $value) { - - $ip_dwn = $this->getall_mangle["$key"]["$this->element_name_dwn"]; - $ip_upl = $this->getall_mangle["$key"]["$this->element_name_upl"]; - - if( isset($this->getall_mangle[$key]["$this->element_name_dwn"]) ) - { - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_dwn"]."_dwn"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_dwn"] = $this->getall_mangle[$key]["$this->element_name_dwn"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $this->arr_objects_dev_dwn[$ip_dwn] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - - //echo "adding: $ip -- $key\n"; - } - elseif( isset($this->getall_mangle[$key]["$this->element_name_upl"]) ) - { - - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_upl"]."_upl"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_upl"] = $this->getall_mangle[$key]["$this->element_name_upl"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if( (empty($diff1) and empty($diff2)) ) - { $this->arr_objects_dev_upl[$ip_upl] = $this->getall_mangle["$key"][".id"]; } - else - { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - } - else - { - echo " WARNING: Nalezeno jiné pravidlo/nelze parsovat. (id: ".$this->getall_mangle["$key"][".id"].") \n"; - - //zde udelat seznam pravidel pro smazani :) - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - - } //end of else if - } - - if( (count($this->wrong_firewall_items) > 0 ) && ($this->force_mangle_rewrite != 1)) - { $this->remove_wrong_items($this->wrong_firewall_items); } - - //print_r($arr_objects_dev_dwn); - //print_r($arr_objects_dev_upl); - if( !(is_array($this->arr_objects_dev_upl)) ) - { $this->arr_objects_dev_upl = array(); } - - if( !(is_array($this->arr_objects_dev_dwn)) ) - { $this->arr_objects_dev_dwn = array(); } - - $arr_obj_dev_diff = array_diff_key($this->arr_objects_dev_dwn, $this->arr_objects_dev_upl); - //print_r($arr_obj_dev_diff); - - $arr_obj_dev_diff2 = array_diff_key($this->arr_objects_dev_upl, $this->arr_objects_dev_dwn); - //print_r($arr_obj_dev_diff2); - - if( (count($arr_obj_dev_diff) > 0) or ( count($arr_obj_dev_diff2) > 0) ) - { - echo " ERROR: Rozdilny pocet zaznamu pro DWN a UPL. Forcing a full sync... \n"; - $this->force_mangle_rewrite = 1; - } - else - { - echo " number of records : device: ".count($this->arr_objects_dev_dwn).", system: ".count($this->objects)."\n"; - - $this->arr_global_diff_exc = array_diff_key($this->arr_objects_dev_dwn, $this->objects); - $this->arr_global_diff_mis = array_diff_key($this->objects, $this->arr_objects_dev_dwn); - } - -} //end of function detect_diff_in_mangle - -function erase_mangle(){ - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->getall_mangle as $key => $value) { - - /* - if(asi nejake vyjimky) - {} - else - */ - { - $erase[] = $this->getall_mangle[$key][".id"]; - //print "erasing id: ".$key."\n"; - } - - } //end of forearch - - $del = $this->conn->remove("/ip/firewall/mangle", $erase); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Item(s) successfully deleted (".count($erase).")\n"; } - $items_suc_del++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - print " count of force deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - //print_r($erase)."\n"; - -} //end of function erase_mangle - -function synchro_mangle_force() -{ - //reseni asi smazat vse a pak pustit synchro_mangle - $this->erase_mangle(); - - $this->detect_diff_in_mangle(); - - $this->synchro_mangle(); - -} //end of function synchro_mangle_force - -function synchro_mangle() -{ - - $items_suc_added = 0; - $items_err_added = 0; - - foreach ($this->arr_global_diff_mis as $ip => $value) { - - $add_par_r = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_dwn", - "$this->item_ip_dwn" => "$ip", "passthrough" => "no"); - $add = $this->conn->add("/ip/firewall/mangle", $add_par_r); - - if( ereg('^\*([[:xdigit:]])*$',$add) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add)."\n"; } - $items_err_added++; - } - - $add_par_r2 = array ("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_upl", - "$this->item_ip_upl" => "$ip", "passthrough" => "no"); - $add2 = $this->conn->add("/ip/firewall/mangle", $add_par_r2); - - if( ereg('^\*([[:xdigit:]])*$',$add2) ) - { - if($debug > 0){ echo " Item ".$add." successfully added \n"; } - $items_suc_added++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($add2)."\n"; } - $items_err_added++; - print_r($add_par_r2); - } - - } //end of foreach $arr_global_diff_mis - - print " count of added items: ok: ".$items_suc_added.", error: ".$items_err_added."\n"; - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->arr_global_diff_exc as $ip => $value) { - - $index = $this->arr_objects_dev_dwn["$ip"]; - $index2 = $this->arr_objects_dev_upl["$ip"]; - - //echo " deleted: ".$ip.", v1: $index, v2: $index2 \n"; - - $del = $this->conn->remove("/ip/firewall/mangle", array("$index","$index2") ); - - if( $del == "1" ) - { - if($debug > 0){ echo " Item(s) successfully deleted (".$index.",".$index2.")\n"; } - $items_suc_del++; - } - else - { - if($debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - } //end of foreach $arr_global_diff_mis - - print " count of deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - -} //end of function synchro_mangle - -function qt_global() { - - //zjisteni agregace SC - $rs_agreg = $conn_mysql->query("SELECT agregace, speed_dwn, speed_upl FROM tarify_int WHERE id_tarifu = '1'"); - - while( $d_agreg = mysql_fetch_array($rs_agreg) ) - { - $this->agregace_sc = $d_agreg["agregace"]; - $this->speed_sc_dwn = $d_agreg["speed_dwn"]; - $this->speed_sc_upl = $d_agreg["speed_upl"]; - } - - foreach ($this->objects as $ip => $linka) { - - if($linka == 1) { - $this->objects_sc[] = $ip; - } - elseif($linka == 0) { - $this->objects_mp[] = $ip; - } - else - { - if(array_key_exists("objects_g_".$linka, $this->objects_garants)) { - //echo " WARNING: garant: "."objects_g_".$linka.", ip> $ip \n"; - $this->{"objects_g_".$linka}[] = $ip; - } - else { - //$this->objects_garants[] - echo " WARNING: Neznámá linka (".$linka.") u objektu: ".$ip."\n"; - } - } - } - - //zredukovat pole objects_garants, dle vyuziti - foreach ($this->objects_garants as $key => $value) { - - if( (count($this->{$key}) > 0 )) { - $this->objects_garants_used[$key] = $value; - } - - } - - //print_r($this->objects_g_2); - //print_r($this->objects_garants_used); - - echo " qt(global) number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - -} - -function qt_delete_all() { - - $qt_suc_del=0; - $qt_err_del=0; - - $qt_del_all = $this->conn->getall(array("queue","tree")); - - foreach ($qt_del_all as $key => $value) { - - $qt_del_all_id[] = $qt_del_all[$key][".id"]; - - } - - $qt_del = $this->conn->remove("/queue/tree", $qt_del_all_id ); - - if( $qt_del == "1" ) { - if($this->debug > 0){ echo " QT Item(s) successfully deleted (".count($qt_del_all_id).")\n"; } - $qt_suc_del++; - } - else { - if($this->debug > 0){ echo " QT ERROR: ".print_r($qt_del_all_id)."\n"; } - $qt_err_del++; - } - - print " qt: deleted items ".count($qt_del_all_id).", ok: ".$qt_suc_del.", error: ".$qt_err_del."\n"; - - // print_r($qt_del_all_id); - -} - -function erase_qt($array){ - - $items_suc_del = 0; - $items_err_del = 0; - - $del = $this->conn->remove("/queue/tree", $array); - - if( $del == "1" ) - { - if($this->debug > 0){ echo " Item(s) successfully deleted (".count($erase).")\n"; } - $items_suc_del++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($del)."\n"; } - $items_err_del++; - } - - echo " qt: count of deleted items: ".count($array).", status: "; - - if( $items_suc_del == 1){ echo " OK "; } - elseif( $items_err_del == 1){ echo " error "; } - else - { echo "unknown (ok: ".$items_suc_del.", error: ".$items_err_del.") "; } - - echo "\n"; - - //print_r($array)."\n"; - -} //end of function erase_qt - -function detect_diff_queues() { - - // - //1. zjistime co je v zarizeni - // - - //$qt_dump = $this->conn->getall( array("queue","tree"), "", "", ".id" ); - $qt_dump = $this->conn->getall( array("queue","tree")); - - $qt_dump_trim = $qt_dump; - - //vymazeme .id, jinak nelze pole porovnat - foreach ($qt_dump_trim as $key => $value) { - - unset($qt_dump_trim["$key"][".id"]); - - } //end of foreach qt_dump_trim - - //2. zjistime, co je v adminatoru - - // - // 2.1 SmallCity Linky - // - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - - //2.1.1 - agregacni SC tridy - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $qt_system[] = array ("name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false"); - } - - //2.1.2 - jednotlive IP adresy - - $qt_system[] = array ("name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "packet-mark" => $ip."_dwn", - "limit-at" => $limit_at_sc_dwn, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_dwn)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "packet-mark" => $ip."_upl", - "limit-at" => $limit_at_sc_upl, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_upl)*1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } //end of foreach array objects_sc - - // - // 2.2 - MP linky - // - - //2.2.1 - globalni MP skupiny - $qt_system[] = array ("name" => "q-dwn-mp-global", "parent" => "global-out", "limit-at" => "0", "priority" => "1", - "max-limit" => "100000000", "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-mp-global", "parent" => "global-out", "limit-at" => "0", "priority" => "1", - "max-limit" => "100000000", "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - - //2.2.2 - klientske linky/skupiny - - foreach ($this->objects_mp as $key => $ip) { - - $qt_system[] = array ("name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "packet-mark" => $ip."_dwn", - "limit-at" => "100000", "queue" => "wireless-default", "priority" => "1", - "max-limit" => "10000000", "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array ("name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "packet-mark" => $ip."_upl", - "limit-at" => "100000", "queue" => "wireless-default", "priority" => "1", - "max-limit" => "10000000", "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - } - - // - // 2.3 - Garanti, routery atd - // - foreach( $this->objects_garants_used as $garant_id => $speeds) - { - list($speed_dwn, $speed_upl) = explode(":",$speeds); - - //parent tridy pro garanty - $qt_system[] = array ("name" => "q-dwn-".$garant_id, "parent" => "global-out", "limit-at" => $speed_dwn."000", - "priority" => "1", "max-limit" => $speed_dwn."000", "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - $qt_system[] = array ("name" => "q-upl-".$garant_id, "parent" => "global-out", "limit-at" => $speed_upl."000", - "priority" => "1", "max-limit" => $speed_upl."000", "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - foreach( $this->{$garant_id} as $id => $ip) - { - - $qt_system[] = array ("name" => "q-dwn-q-".$ip, "parent" => "q-dwn-".$garant_id, "packet-mark" => $ip."_dwn", - "limit-at" => "0", "queue" => "wireless-default", "priority" => "1", "max-limit" => "0", - "burst-limit" => "0", "burst-threshold" => "0", "burst-time" => "00:00:00", - "invalid" => "false", "disabled" => "false" ); - - $qt_system[] = array ("name" => "q-upl-q-".$ip, "parent" => "q-upl-".$garant_id, "packet-mark" => $ip."_upl", - "limit-at" => "0", "queue" => "wireless-default", "priority" => "1", "max-limit" => "0", - "burst-limit" => "0", "burst-threshold" => "0", "burst-time" => "00:00:00", - "invalid" => "false", "disabled" => "false"); - - } - - } - - // - // 3. porovname pole - // - - /* pole se zaznamama */ - //echo "--- printing qt_dump_trim --- \n"; print_r($qt_dump_trim); - //echo "--- printing qt_system --- \n"; print_r($qt_system); - - $this->qt_ar_exc = $this->arrayDiff($qt_dump_trim, $qt_system); - $this->qt_ar_mis = $this->arrayDiff($qt_system, $qt_dump_trim); - - echo " qt: count of classess: excess: ".count($this->qt_ar_exc).", missing: ".count($this->qt_ar_mis)." \n"; - - if( (count($this->qt_ar_exc) > 0 ) or (count($this->qt_ar_mis) > 0 ) ) - { - //neco nesedi .. - //echo "--- printing qt_ar_exc --- \n"; print_r($this->qt_ar_exc); - //echo "--- printing qt_ar_mis --- \n"; print_r($this->qt_ar_mis); - - //prebejvajici zaznamy smazat - - foreach($this->qt_ar_exc as $key => $val) - { - $item_id = $qt_dump[$key][".id"]; - //print " add erase number: ".$key.", item_id: ".$item_id." \n"; - - if( (strlen($item_id) > 0 ) ) - { $qt_delete_items[] = $item_id; } - } //end of foreach this->qt_ar_exc - - if( ( is_array($qt_delete_items) and (count($qt_delete_items) > 0) ) ) - { - //print "--- qt_delete_items --- \n"; print_r($qt_delete_items); - $this->erase_qt($qt_delete_items); - } - else - { echo " qt: no excess items \n"; } - - //pridame chybejici zaznamy - if( ( is_array($this->qt_ar_mis) and (count($this->qt_ar_mis) > 0) ) ) - { - //print_r($this->qt_ar_mis); - - foreach($this->qt_ar_mis as $key => $val) - { - //echo $key." => "; print_r($qt_system[$key])." \n"; - $array = $qt_system[$key]; - - unset($array["invalid"]); - $this->qt_add_single($array); - } - - } - else - { echo " qt: no missing items \n"; } - - //a... hotovo :-) - - } - else - { - //zaznamy sedi, nemam co delat - echo " qt: no excess or missing items (OK) \n"; - - } - - -} //end of function datect_diff_queues - -function qt_add_single($input_array) -{ - $qt_items_suc_added = 0; - $qt_items_err_added = 0; - - $add_qt = $this->conn->add("/queue/tree", $input_array); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - //if($this->debug > 0) - { echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - -} //end of qt_add_single - -function synchro_qt_force() -{ - - //for testing, erasing arrays - //$this->objects_sc = array(); - //$this->objects_mp = array(); - - echo " qt - force rewriting ... \n"; - $this->qt_delete_all(); - - echo " tarif info: SmallCity: agregace: ".$this->agregace_sc.", speed dwn: ".$this->speed_sc_dwn."k, upl: ".$this->speed_sc_upl."k \n"; - - echo " qt number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - echo " qt number of records tariff: garants: ".count($this->objects_garants_used)."\n"; - - $sc_group=1; - $sc_count=0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc)*1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc)*1000; - - $qt_ip_suc_added=0; - $qt_ip_err_added=0; - - //muster queues pro SC - ///queue tree - //add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1024k max-limit=1024k name=\ - // q-dwn-sc-1 parent=global-in priority=1 - - // - // QT - SMallCity - // - foreach ($this->objects_sc as $key => $ip) { - - if($sc_count == 0) - { //zresetovan citac sc, tj. vytvorime globalni skupinu - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef)*1000; - - $qt_items_suc_added=0; - $qt_items_err_added=0; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef)*1000; - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - - print " add QT Group Sc No. ".$sc_group.", items ok: ".$qt_items_suc_added.", error: ".$qt_items_err_added."\n"; - - } - - // add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=1024k name=\ - // q-dwn-sc-10.2.2.2.2 packet-mark=10.52.5.14_dwn parent=q-dwn-sc-1 priority=1 queue=\ - // wireless-default - - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_dwn, "max-limit" => (($this->speed_sc_dwn)*1000), - "name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - $add_qt_data = array ("disabled" => "false", "limit-at" => $limit_at_sc_upl, "max-limit" => (($this->speed_sc_upl)*1000), - "name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt." successfully added \n"; } - $qt_ip_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_ip_err_added++; - } - - //konec cyklu - $sc_count++; - - if( $sc_count == $this->agregace_sc) - { - $sc_count=0; - $sc_group++; - } - } - - print " qt: count of added items: ok: ".$qt_ip_suc_added.", error: ".$qt_ip_err_added."\n"; - - // - // QT Force - MP linky - // - $qt_mp_items_suc_added=0; - $qt_mp_items_err_added=0; - - //globalni tridy pro MP - - $add_qt_mp_global_data = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-dwn-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global = $this->conn->add("/queue/tree", $add_qt_mp_global_data); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_mp_global_data2 = array ("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-upl-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global2 = $this->conn->add("/queue/tree", $add_qt_mp_global_data2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp_global2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp_global2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp_global2)."\n"; } - $qt_mp_items_err_added++; - } - - foreach ($this->objects_mp as $key => $ip) { - - $add_qt_data_mp = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_mp = $this->conn->add("/queue/tree", $add_qt_data_mp); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp)."\n"; } - $qt_mp_items_err_added++; - } - - $add_qt_data_mp2 = array ("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_mp2 = $this->conn->add("/queue/tree", $add_qt_data_mp2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_mp2) ) - { - if($this->debug > 0){ echo " QT Item ".$add_qt_mp2." successfully added \n"; } - $qt_mp_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_mp2)."\n"; } - $qt_mp_items_err_added++; - } - - } - - print " qt: number of records with MP: added items: ok: ".$qt_mp_items_suc_added.", error: ".$qt_mp_items_err_added."\n"; - - // - // QT Force - Garanty - // - $qt_g_items_suc_added = 0; - $qt_g_items_err_added = 0; - - foreach( $this->objects_garants_used as $garant_id => $speeds) - { - list($speed_dwn, $speed_upl) = explode(":",$speeds); - - print " qt-force :: garants :: ".$garant_id.", speed_dwn: ".$speed_dwn.", speed_upl: ".$speed_upl."\n"; - - $add_qt_data_g = array ("disabled" => "false", "limit-at" => $speed_dwn."k", "max-limit" => $speed_dwn."k", - "name" => "q-dwn-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g = $this->conn->add("/queue/tree", $add_qt_data_g); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g) ) - { - if($this->debug > 0){ echo " QT Item (garant parent dwn) ".$add_qt_g." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q)."\n"; } - $qt_g_items_err_added++; - } - - $add_qt_data_g2 = array ("disabled" => "false", "limit-at" => $speed_upl."k", "max-limit" => $speed_upl."k", - "name" => "q-upl-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g2 = $this->conn->add("/queue/tree", $add_qt_data_g2); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g2) ) - { - if($this->debug > 0){ echo " QT Item (garant parent upl) ".$add_qt_g2." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q2)."\n"; } - $qt_g_items_err_added++; - } - - foreach( $this->{$garant_id} as $id => $ip) - { - - $add_qt_data_g_dwn = array ("disabled" => "false", "name" => "q-dwn-q-".$ip, "parent" => "q-dwn-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_g_dwn = $this->conn->add("/queue/tree", $add_qt_data_g_dwn); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g_dwn) ) - { - if($this->debug > 0){ echo " QT Item (garant ".$ip." dwn) ".$add_qt_g_dwn." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q_dwn)."\n"; } - $qt_g_items_err_added++; - } - - $add_qt_data_g_upl = array ("disabled" => "false", "name" => "q-upl-q-".$ip, "parent" => "q-upl-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_g_upl = $this->conn->add("/queue/tree", $add_qt_data_g_upl); - - if( ereg('^\*([[:xdigit:]])*$',$add_qt_g_upl) ) - { - if($this->debug > 0){ echo " QT Item (garant ".$ip." upl) ".$add_qt_g_upl." successfully added \n"; } - $qt_g_items_suc_added++; - } - else - { - if($this->debug > 0){ echo " ERROR: ".print_r($add_qt_q2)."\n"; } - $qt_g_items_err_added++; - } - - - } //end of FOREACH $this->{$garant_id} - - } //end of FOREACH objects_garants_used - - print " qt: number of records with GARANT: added items: ok: ".$qt_g_items_suc_added.", error: ".$qt_g_items_err_added."\n"; - -} //end of function synchro_qt_force - - -} //end of class mk_synchro_qos - - - -?> diff --git a/adminator2/platby-vypis.php b/adminator2/platby-vypis.php index 0a9e92b11..0d3e912e1 100644 --- a/adminator2/platby-vypis.php +++ b/adminator2/platby-vypis.php @@ -29,25 +29,13 @@ - + diff --git a/adminator3/composer.json b/adminator3/composer.json index fcaa0572b..8d8213c37 100644 --- a/adminator3/composer.json +++ b/adminator3/composer.json @@ -38,7 +38,6 @@ "setasign/fpdf": "1.8.6", "phpmailer/phpmailer": "^6.9.1", "lloricode/laravel-html-table": "^2.1", - "evilfreelancer/routeros-api-php": "1.5.2", "robmorgan/phinx": "^0.12.10", "open-telemetry/opentelemetry-auto-slim": "1.1.1", "open-telemetry/exporter-otlp": "1.3.1", diff --git a/adminator3/composer.lock b/adminator3/composer.lock index 56272c067..bad632608 100644 --- a/adminator3/composer.lock +++ b/adminator3/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "68f14e17f059ca4bbb6171f9e75580f7", + "content-hash": "a99b79586617bfecbc1a60c1cdfb7b8f", "packages": [ { "name": "amnuts/opcache-gui", @@ -1107,97 +1107,6 @@ ], "time": "2025-03-06T22:45:56+00:00" }, - { - "name": "evilfreelancer/routeros-api-php", - "version": "1.5.2", - "source": { - "type": "git", - "url": "https://github.com/EvilFreelancer/routeros-api-php.git", - "reference": "f247a4cfa6126a8d0302dbbc4a7a7520cbb0d8a3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/EvilFreelancer/routeros-api-php/zipball/f247a4cfa6126a8d0302dbbc4a7a7520cbb0d8a3", - "reference": "f247a4cfa6126a8d0302dbbc4a7a7520cbb0d8a3", - "shasum": "" - }, - "require": { - "ext-sockets": "*", - "php": "^7.4|^8.0", - "spatie/ssh": "^1.8" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.16", - "larapack/dd": "^1.1", - "limedeck/phpunit-detailed-printer": "^5.0", - "orchestra/testbench": "^4.0|^5.0", - "phpunit/phpunit": "^8.0", - "rector/rector": "^0.7|^0.8|^0.9", - "roave/security-advisories": "dev-master", - "squizlabs/php_codesniffer": "^3.5" - }, - "type": "library", - "extra": { - "laravel": { - "aliases": { - "RouterOS": "RouterOS\\Laravel\\Facade" - }, - "providers": [ - "RouterOS\\Laravel\\ServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "RouterOS\\": "./src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paul Rock", - "email": "paul@drteam.rocks", - "homepage": "http://drteam.rocks/", - "role": "Developer" - } - ], - "description": "Modern Mikrotik RouterOS API PHP client for your applications (with Laravel support)", - "keywords": [ - "PSR-4", - "facade", - "laravel", - "mikrotik", - "plugin", - "routeros", - "socket-client" - ], - "support": { - "issues": "https://github.com/EvilFreelancer/routeros-api-php/issues", - "source": "https://github.com/EvilFreelancer/routeros-api-php/tree/1.5.2" - }, - "funding": [ - { - "url": "https://streamlabs.com/evilfreelancer/tip", - "type": "custom" - }, - { - "url": "https://www.donationalerts.com/r/evilfreelancer", - "type": "custom" - }, - { - "url": "https://ko-fi.com/efreelancer", - "type": "ko_fi" - }, - { - "url": "https://www.patreon.com/efreelancer", - "type": "patreon" - } - ], - "time": "2023-12-03T10:28:22+00:00" - }, { "name": "fig/http-message-util", "version": "1.1.5", @@ -2451,16 +2360,16 @@ }, { "name": "league/flysystem", - "version": "3.29.1", + "version": "3.30.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319" + "reference": "2203e3151755d874bb2943649dae1eb8533ac93e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/edc1bb7c86fab0776c3287dbd19b5fa278347319", - "reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/2203e3151755d874bb2943649dae1eb8533ac93e", + "reference": "2203e3151755d874bb2943649dae1eb8533ac93e", "shasum": "" }, "require": { @@ -2484,13 +2393,13 @@ "composer/semver": "^3.0", "ext-fileinfo": "*", "ext-ftp": "*", - "ext-mongodb": "^1.3", + "ext-mongodb": "^1.3|^2", "ext-zip": "*", "friendsofphp/php-cs-fixer": "^3.5", "google/cloud-storage": "^1.23", "guzzlehttp/psr7": "^2.6", "microsoft/azure-storage-blob": "^1.1", - "mongodb/mongodb": "^1.2", + "mongodb/mongodb": "^1.2|^2", "phpseclib/phpseclib": "^3.0.36", "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^9.5.11|^10.0", @@ -2528,22 +2437,22 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.29.1" + "source": "https://github.com/thephpleague/flysystem/tree/3.30.0" }, - "time": "2024-10-08T08:58:34+00:00" + "time": "2025-06-25T13:29:59+00:00" }, { "name": "league/flysystem-local", - "version": "3.29.0", + "version": "3.30.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-local.git", - "reference": "e0e8d52ce4b2ed154148453d321e97c8e931bd27" + "reference": "6691915f77c7fb69adfb87dcd550052dc184ee10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/e0e8d52ce4b2ed154148453d321e97c8e931bd27", - "reference": "e0e8d52ce4b2ed154148453d321e97c8e931bd27", + "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/6691915f77c7fb69adfb87dcd550052dc184ee10", + "reference": "6691915f77c7fb69adfb87dcd550052dc184ee10", "shasum": "" }, "require": { @@ -2577,9 +2486,9 @@ "local" ], "support": { - "source": "https://github.com/thephpleague/flysystem-local/tree/3.29.0" + "source": "https://github.com/thephpleague/flysystem-local/tree/3.30.0" }, - "time": "2024-08-09T21:24:39+00:00" + "time": "2025-05-21T10:34:19+00:00" }, { "name": "league/mime-type-detection", @@ -3998,16 +3907,16 @@ }, { "name": "open-telemetry/api", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/api.git", - "reference": "4e3bb38e069876fb73c2ce85c89583bf2b28cd86" + "reference": "b3a9286f9c1c8247c83493c5b1fa475cd0cec7f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/4e3bb38e069876fb73c2ce85c89583bf2b28cd86", - "reference": "4e3bb38e069876fb73c2ce85c89583bf2b28cd86", + "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/b3a9286f9c1c8247c83493c5b1fa475cd0cec7f7", + "reference": "b3a9286f9c1c8247c83493c5b1fa475cd0cec7f7", "shasum": "" }, "require": { @@ -4027,7 +3936,7 @@ ] }, "branch-alias": { - "dev-main": "1.1.x-dev" + "dev-main": "1.4.x-dev" } }, "autoload": { @@ -4064,7 +3973,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-05-07T12:32:21+00:00" + "time": "2025-06-19T23:36:51+00:00" }, { "name": "open-telemetry/context", @@ -4380,22 +4289,22 @@ }, { "name": "open-telemetry/sdk", - "version": "1.5.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "cd0d7367599717fc29e04eb8838ec061e6c2c657" + "reference": "1c0371794e4c0700afd4a9d4d8511cb5e3f78e6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/cd0d7367599717fc29e04eb8838ec061e6c2c657", - "reference": "cd0d7367599717fc29e04eb8838ec061e6c2c657", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/1c0371794e4c0700afd4a9d4d8511cb5e3f78e6a", + "reference": "1c0371794e4c0700afd4a9d4d8511cb5e3f78e6a", "shasum": "" }, "require": { "ext-json": "*", "nyholm/psr7-server": "^1.1", - "open-telemetry/api": "~1.0 || ~1.1", + "open-telemetry/api": "~1.4.0", "open-telemetry/context": "^1.0", "open-telemetry/sem-conv": "^1.0", "php": "^8.1", @@ -4418,6 +4327,10 @@ "type": "library", "extra": { "spi": { + "OpenTelemetry\\API\\Configuration\\ConfigEnv\\EnvComponentLoader": [ + "OpenTelemetry\\API\\Instrumentation\\Configuration\\General\\ConfigEnv\\EnvComponentLoaderHttpConfig", + "OpenTelemetry\\API\\Instrumentation\\Configuration\\General\\ConfigEnv\\EnvComponentLoaderPeerConfig" + ], "OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\HookManagerInterface": [ "OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\ExtensionHookManager" ] @@ -4466,20 +4379,20 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-05-22T02:33:34+00:00" + "time": "2025-06-19T23:36:51+00:00" }, { "name": "open-telemetry/sem-conv", - "version": "1.32.0", + "version": "1.32.1", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sem-conv.git", - "reference": "16585cc0dbc3032a318e274043454679430d2ebf" + "reference": "94daa85ea61a8e2b7e1b0af6be0e875bedda7c22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/16585cc0dbc3032a318e274043454679430d2ebf", - "reference": "16585cc0dbc3032a318e274043454679430d2ebf", + "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/94daa85ea61a8e2b7e1b0af6be0e875bedda7c22", + "reference": "94daa85ea61a8e2b7e1b0af6be0e875bedda7c22", "shasum": "" }, "require": { @@ -4523,7 +4436,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-05-05T03:58:53+00:00" + "time": "2025-06-24T02:32:27+00:00" }, { "name": "open-telemetry/transport-grpc", @@ -5087,16 +5000,16 @@ }, { "name": "phpoffice/phpspreadsheet", - "version": "2.3.8", + "version": "2.3.9", "source": { "type": "git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "7a700683743bf1c4a21837c84b266916f1aa7d25" + "reference": "12e0d9f5ef459bf4d3427ef1bbe256b0d85f1e3a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/7a700683743bf1c4a21837c84b266916f1aa7d25", - "reference": "7a700683743bf1c4a21837c84b266916f1aa7d25", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/12e0d9f5ef459bf4d3427ef1bbe256b0d85f1e3a", + "reference": "12e0d9f5ef459bf4d3427ef1bbe256b0d85f1e3a", "shasum": "" }, "require": { @@ -5186,9 +5099,9 @@ ], "support": { "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", - "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/2.3.8" + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/2.3.9" }, - "time": "2025-02-08T03:01:45+00:00" + "time": "2025-06-23T01:20:15+00:00" }, { "name": "phpoption/phpoption", @@ -5974,21 +5887,20 @@ }, { "name": "ramsey/uuid", - "version": "4.8.1", + "version": "4.9.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "fdf4dd4e2ff1813111bd0ad58d7a1ddbb5b56c28" + "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/fdf4dd4e2ff1813111bd0ad58d7a1ddbb5b56c28", - "reference": "fdf4dd4e2ff1813111bd0ad58d7a1ddbb5b56c28", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/4e0e23cc785f0724a0e838279a9eb03f28b092a0", + "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0", "shasum": "" }, "require": { "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13", - "ext-json": "*", "php": "^8.0", "ramsey/collection": "^1.2 || ^2.0" }, @@ -6047,9 +5959,9 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.8.1" + "source": "https://github.com/ramsey/uuid/tree/4.9.0" }, - "time": "2025-06-01T06:28:46+00:00" + "time": "2025-06-25T14:20:11+00:00" }, { "name": "respect/stringifier", @@ -6853,65 +6765,6 @@ ], "time": "2025-04-11T15:27:14+00:00" }, - { - "name": "spatie/ssh", - "version": "1.13.0", - "source": { - "type": "git", - "url": "https://github.com/spatie/ssh.git", - "reference": "cfccf0873611a2d1b030f65d1dd319c8005d993f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/ssh/zipball/cfccf0873611a2d1b030f65d1dd319c8005d993f", - "reference": "cfccf0873611a2d1b030f65d1dd319c8005d993f", - "shasum": "" - }, - "require": { - "php": "^7.4|^8.0", - "symfony/process": "^4.4|^5.3|^6.0|^7.0" - }, - "require-dev": { - "pestphp/pest": "^1.22", - "spatie/pest-plugin-snapshots": "^1.1", - "symfony/var-dumper": "^5.3|6.0|^7.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Spatie\\Ssh\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Freek Van der Herten", - "email": "freek@spatie.be", - "homepage": "https://spatie.be", - "role": "Developer" - } - ], - "description": "A lightweight package to execute commands over an SSH connection", - "homepage": "https://github.com/spatie/ssh", - "keywords": [ - "spatie", - "ssh" - ], - "support": { - "issues": "https://github.com/spatie/ssh/issues", - "source": "https://github.com/spatie/ssh/tree/1.13.0" - }, - "funding": [ - { - "url": "https://spatie.be/open-source/support-us", - "type": "custom" - } - ], - "time": "2024-12-23T10:27:18+00:00" - }, { "name": "symfony/config", "version": "v6.4.22", diff --git a/adminator3/tests/adminator/Work/WorkTest.php b/adminator3/tests/adminator/Work/WorkTest.php index 5803aaa34..116b2050f 100644 --- a/adminator3/tests/adminator/Work/WorkTest.php +++ b/adminator3/tests/adminator/Work/WorkTest.php @@ -48,7 +48,7 @@ public function testTaskEnqueue() for ($i = 0; $i < 250; $i++) { - [$rs, $task] = $work->taskEnqueue($faker->numberBetween(1, 30)); + [$rs, $task] = $work->taskEnqueue($faker->numberBetween(1, 24)); $this->assertTrue($task); } From c4d2c9c474874477c45b809aedf9c01bba614e65 Mon Sep 17 00:00:00 2001 From: Patrik Majer Date: Sun, 29 Jun 2025 08:47:17 +0200 Subject: [PATCH 2/4] fix 1 --- adminator2/composer.lock | 1996 +++++++++++------ adminator3/app/Core/shared/ros_api_qos.php | 1317 ----------- .../app/Core/shared/ros_api_restriction.php | 344 --- 3 files changed, 1290 insertions(+), 2367 deletions(-) delete mode 100644 adminator3/app/Core/shared/ros_api_qos.php delete mode 100644 adminator3/app/Core/shared/ros_api_restriction.php diff --git a/adminator2/composer.lock b/adminator2/composer.lock index 40916db90..e58e5ceeb 100644 --- a/adminator2/composer.lock +++ b/adminator2/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1afaeb630957d0f083c16367afcf2d98", + "content-hash": "998e4db832c8e0493521dfb5277be9fc", "packages": [ { "name": "brick/math", - "version": "0.12.1", + "version": "0.12.3", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "f510c0a40911935b77b86859eb5223d58d660df1" + "reference": "866551da34e9a618e64a819ee1e01c20d8a588ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/f510c0a40911935b77b86859eb5223d58d660df1", - "reference": "f510c0a40911935b77b86859eb5223d58d660df1", + "url": "https://api.github.com/repos/brick/math/zipball/866551da34e9a618e64a819ee1e01c20d8a588ba", + "reference": "866551da34e9a618e64a819ee1e01c20d8a588ba", "shasum": "" }, "require": { @@ -26,7 +26,7 @@ "require-dev": { "php-coveralls/php-coveralls": "^2.2", "phpunit/phpunit": "^10.1", - "vimeo/psalm": "5.16.0" + "vimeo/psalm": "6.8.8" }, "type": "library", "autoload": { @@ -56,7 +56,7 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.12.1" + "source": "https://github.com/brick/math/tree/0.12.3" }, "funding": [ { @@ -64,7 +64,7 @@ "type": "github" } ], - "time": "2023-11-29T23:19:16+00:00" + "time": "2025-02-28T13:11:00+00:00" }, { "name": "carbonphp/carbon-doctrine-types", @@ -171,19 +171,19 @@ }, "type": "library", "extra": { - "component": "package", - "branch-alias": { - "dev-master": "7.0.x-dev" - }, "laravel": { - "providers": [ - "Cartalyst\\Sentinel\\Laravel\\SentinelServiceProvider" - ], "aliases": { - "Activation": "Cartalyst\\Sentinel\\Laravel\\Facades\\Activation", "Reminder": "Cartalyst\\Sentinel\\Laravel\\Facades\\Reminder", - "Sentinel": "Cartalyst\\Sentinel\\Laravel\\Facades\\Sentinel" - } + "Sentinel": "Cartalyst\\Sentinel\\Laravel\\Facades\\Sentinel", + "Activation": "Cartalyst\\Sentinel\\Laravel\\Facades\\Activation" + }, + "providers": [ + "Cartalyst\\Sentinel\\Laravel\\SentinelServiceProvider" + ] + }, + "component": "package", + "branch-alias": { + "dev-master": "7.0.x-dev" } }, "autoload": { @@ -368,109 +368,18 @@ ], "time": "2024-02-18T20:23:39+00:00" }, - { - "name": "evilfreelancer/routeros-api-php", - "version": "1.5.2", - "source": { - "type": "git", - "url": "https://github.com/EvilFreelancer/routeros-api-php.git", - "reference": "f247a4cfa6126a8d0302dbbc4a7a7520cbb0d8a3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/EvilFreelancer/routeros-api-php/zipball/f247a4cfa6126a8d0302dbbc4a7a7520cbb0d8a3", - "reference": "f247a4cfa6126a8d0302dbbc4a7a7520cbb0d8a3", - "shasum": "" - }, - "require": { - "ext-sockets": "*", - "php": "^7.4|^8.0", - "spatie/ssh": "^1.8" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.16", - "larapack/dd": "^1.1", - "limedeck/phpunit-detailed-printer": "^5.0", - "orchestra/testbench": "^4.0|^5.0", - "phpunit/phpunit": "^8.0", - "rector/rector": "^0.7|^0.8|^0.9", - "roave/security-advisories": "dev-master", - "squizlabs/php_codesniffer": "^3.5" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "RouterOS\\Laravel\\ServiceProvider" - ], - "aliases": { - "RouterOS": "RouterOS\\Laravel\\Facade" - } - } - }, - "autoload": { - "psr-4": { - "RouterOS\\": "./src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paul Rock", - "email": "paul@drteam.rocks", - "homepage": "http://drteam.rocks/", - "role": "Developer" - } - ], - "description": "Modern Mikrotik RouterOS API PHP client for your applications (with Laravel support)", - "keywords": [ - "PSR-4", - "facade", - "laravel", - "mikrotik", - "plugin", - "routeros", - "socket-client" - ], - "support": { - "issues": "https://github.com/EvilFreelancer/routeros-api-php/issues", - "source": "https://github.com/EvilFreelancer/routeros-api-php/tree/1.5.2" - }, - "funding": [ - { - "url": "https://streamlabs.com/evilfreelancer/tip", - "type": "custom" - }, - { - "url": "https://www.donationalerts.com/r/evilfreelancer", - "type": "custom" - }, - { - "url": "https://ko-fi.com/efreelancer", - "type": "ko_fi" - }, - { - "url": "https://www.patreon.com/efreelancer", - "type": "patreon" - } - ], - "time": "2023-12-03T10:28:22+00:00" - }, { "name": "formr/formr", - "version": "1.5.0", + "version": "v1.5.3", "source": { "type": "git", "url": "https://github.com/formr/formr.git", - "reference": "0044558d5afb5a30257c66823d29c54f0c1d28fe" + "reference": "433a4d332dec207200f2dcb0cfee131958102fb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/formr/formr/zipball/0044558d5afb5a30257c66823d29c54f0c1d28fe", - "reference": "0044558d5afb5a30257c66823d29c54f0c1d28fe", + "url": "https://api.github.com/repos/formr/formr/zipball/433a4d332dec207200f2dcb0cfee131958102fb7", + "reference": "433a4d332dec207200f2dcb0cfee131958102fb7", "shasum": "" }, "require": { @@ -497,7 +406,7 @@ "description": "Formr is a PHP library which helps you build and validate forms quickly, painlessly, and without all the messy overhead.", "support": { "issues": "https://github.com/formr/formr/issues", - "source": "https://github.com/formr/formr/tree/1.5.0" + "source": "https://github.com/formr/formr/tree/v1.5.3" }, "funding": [ { @@ -505,20 +414,20 @@ "type": "github" } ], - "time": "2024-02-24T22:40:03+00:00" + "time": "2025-03-16T22:39:28+00:00" }, { "name": "illuminate/bus", - "version": "v10.48.10", + "version": "v10.48.28", "source": { "type": "git", "url": "https://github.com/illuminate/bus.git", - "reference": "33993b8f54e91b03fb5000e55693e146e7370763" + "reference": "c66d57011eec385055e1426d026c270aeecb05aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/bus/zipball/33993b8f54e91b03fb5000e55693e146e7370763", - "reference": "33993b8f54e91b03fb5000e55693e146e7370763", + "url": "https://api.github.com/repos/illuminate/bus/zipball/c66d57011eec385055e1426d026c270aeecb05aa", + "reference": "c66d57011eec385055e1426d026c270aeecb05aa", "shasum": "" }, "require": { @@ -558,20 +467,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-02-23T15:38:25+00:00" + "time": "2024-11-21T14:02:44+00:00" }, { "name": "illuminate/collections", - "version": "v10.48.10", + "version": "v10.48.28", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", - "reference": "f9589f1063a449111dcaa1d68285b507d9483a95" + "reference": "48de3d6bc6aa779112ddcb608a3a96fc975d89d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/collections/zipball/f9589f1063a449111dcaa1d68285b507d9483a95", - "reference": "f9589f1063a449111dcaa1d68285b507d9483a95", + "url": "https://api.github.com/repos/illuminate/collections/zipball/48de3d6bc6aa779112ddcb608a3a96fc975d89d8", + "reference": "48de3d6bc6aa779112ddcb608a3a96fc975d89d8", "shasum": "" }, "require": { @@ -613,20 +522,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-03-20T20:09:13+00:00" + "time": "2024-11-21T14:02:44+00:00" }, { "name": "illuminate/conditionable", - "version": "v10.48.10", + "version": "v10.48.28", "source": { "type": "git", "url": "https://github.com/illuminate/conditionable.git", - "reference": "d0958e4741fc9d6f516a552060fd1b829a85e009" + "reference": "3ee34ac306fafc2a6f19cd7cd68c9af389e432a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/conditionable/zipball/d0958e4741fc9d6f516a552060fd1b829a85e009", - "reference": "d0958e4741fc9d6f516a552060fd1b829a85e009", + "url": "https://api.github.com/repos/illuminate/conditionable/zipball/3ee34ac306fafc2a6f19cd7cd68c9af389e432a5", + "reference": "3ee34ac306fafc2a6f19cd7cd68c9af389e432a5", "shasum": "" }, "require": { @@ -659,20 +568,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-02-03T08:06:17+00:00" + "time": "2024-11-21T14:02:44+00:00" }, { "name": "illuminate/container", - "version": "v10.48.10", + "version": "v10.48.28", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", - "reference": "ddc26273085fad3c471b2602ad820e0097ff7939" + "reference": "ed6253f7dd3a67d468b2cc7a69a657e1f14c7ba3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/ddc26273085fad3c471b2602ad820e0097ff7939", - "reference": "ddc26273085fad3c471b2602ad820e0097ff7939", + "url": "https://api.github.com/repos/illuminate/container/zipball/ed6253f7dd3a67d468b2cc7a69a657e1f14c7ba3", + "reference": "ed6253f7dd3a67d468b2cc7a69a657e1f14c7ba3", "shasum": "" }, "require": { @@ -710,20 +619,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-06-18T09:12:03+00:00" + "time": "2024-11-21T14:02:44+00:00" }, { "name": "illuminate/contracts", - "version": "v10.48.10", + "version": "v10.48.28", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac" + "reference": "f90663a69f926105a70b78060a31f3c64e2d1c74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac", - "reference": "8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/f90663a69f926105a70b78060a31f3c64e2d1c74", + "reference": "f90663a69f926105a70b78060a31f3c64e2d1c74", "shasum": "" }, "require": { @@ -758,20 +667,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-01-15T18:52:32+00:00" + "time": "2024-11-21T14:02:44+00:00" }, { "name": "illuminate/database", - "version": "v10.48.10", + "version": "v10.48.28", "source": { "type": "git", "url": "https://github.com/illuminate/database.git", - "reference": "eb8edf206d3a6eea8894bc6e21f53469e27dd5c9" + "reference": "2246a636ba1f1e0cc6a5711f0e3929c6c303d937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/eb8edf206d3a6eea8894bc6e21f53469e27dd5c9", - "reference": "eb8edf206d3a6eea8894bc6e21f53469e27dd5c9", + "url": "https://api.github.com/repos/illuminate/database/zipball/2246a636ba1f1e0cc6a5711f0e3929c6c303d937", + "reference": "2246a636ba1f1e0cc6a5711f0e3929c6c303d937", "shasum": "" }, "require": { @@ -831,20 +740,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-04-29T13:23:17+00:00" + "time": "2024-12-08T15:36:59+00:00" }, { "name": "illuminate/events", - "version": "v10.48.10", + "version": "v10.48.28", "source": { "type": "git", "url": "https://github.com/illuminate/events.git", - "reference": "a931bfa88edc6ac52c9abbfd7b769343d321d3eb" + "reference": "3edcdad2f2fe6da6802afb0a256b0f7ee00d72e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/events/zipball/a931bfa88edc6ac52c9abbfd7b769343d321d3eb", - "reference": "a931bfa88edc6ac52c9abbfd7b769343d321d3eb", + "url": "https://api.github.com/repos/illuminate/events/zipball/3edcdad2f2fe6da6802afb0a256b0f7ee00d72e9", + "reference": "3edcdad2f2fe6da6802afb0a256b0f7ee00d72e9", "shasum": "" }, "require": { @@ -886,11 +795,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-03-04T14:41:04+00:00" + "time": "2024-11-21T14:02:44+00:00" }, { "name": "illuminate/macroable", - "version": "v10.48.10", + "version": "v10.48.28", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", @@ -936,16 +845,16 @@ }, { "name": "illuminate/pipeline", - "version": "v10.48.10", + "version": "v10.48.28", "source": { "type": "git", "url": "https://github.com/illuminate/pipeline.git", - "reference": "f802187e917a171332cc90f8c1a102939c57405d" + "reference": "3030a131e5e9cb18c9a826428fcffc076df9dcd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/pipeline/zipball/f802187e917a171332cc90f8c1a102939c57405d", - "reference": "f802187e917a171332cc90f8c1a102939c57405d", + "url": "https://api.github.com/repos/illuminate/pipeline/zipball/3030a131e5e9cb18c9a826428fcffc076df9dcd7", + "reference": "3030a131e5e9cb18c9a826428fcffc076df9dcd7", "shasum": "" }, "require": { @@ -980,20 +889,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-12-19T14:47:26+00:00" + "time": "2024-11-21T14:02:44+00:00" }, { "name": "illuminate/support", - "version": "v10.48.10", + "version": "v10.48.28", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "ee3a1aaed36d916654ce0ae09dfbd38644a4f582" + "reference": "6d09b480d34846245d9288f4dcefb17a73ce6e6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/ee3a1aaed36d916654ce0ae09dfbd38644a4f582", - "reference": "ee3a1aaed36d916654ce0ae09dfbd38644a4f582", + "url": "https://api.github.com/repos/illuminate/support/zipball/6d09b480d34846245d9288f4dcefb17a73ce6e6a", + "reference": "6d09b480d34846245d9288f4dcefb17a73ce6e6a", "shasum": "" }, "require": { @@ -1014,7 +923,7 @@ }, "suggest": { "illuminate/filesystem": "Required to use the composer class (^10.0).", - "league/commonmark": "Required to use Str::markdown() and Stringable::markdown() (^2.0.2).", + "league/commonmark": "Required to use Str::markdown() and Stringable::markdown() (^2.6).", "ramsey/uuid": "Required to use Str::uuid() (^4.7).", "symfony/process": "Required to use the composer class (^6.2).", "symfony/uid": "Required to use Str::ulid() (^6.2).", @@ -1051,20 +960,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-04-07T17:47:33+00:00" + "time": "2024-12-10T14:47:55+00:00" }, { "name": "monolog/monolog", - "version": "3.6.0", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "4b18b21a5527a3d5ffdac2fd35d3ab25a9597654" + "reference": "10d85740180ecba7896c87e06a166e0c95a0e3b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/4b18b21a5527a3d5ffdac2fd35d3ab25a9597654", - "reference": "4b18b21a5527a3d5ffdac2fd35d3ab25a9597654", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/10d85740180ecba7896c87e06a166e0c95a0e3b6", + "reference": "10d85740180ecba7896c87e06a166e0c95a0e3b6", "shasum": "" }, "require": { @@ -1084,12 +993,14 @@ "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", - "phpstan/phpstan": "^1.9", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-strict-rules": "^1.4", - "phpunit/phpunit": "^10.5.17", + "php-console/php-console": "^3.1.8", + "phpstan/phpstan": "^2", + "phpstan/phpstan-deprecation-rules": "^2", + "phpstan/phpstan-strict-rules": "^2", + "phpunit/phpunit": "^10.5.17 || ^11.0.7", "predis/predis": "^1.1 || ^2", - "ruflin/elastica": "^7", + "rollbar/rollbar": "^4.0", + "ruflin/elastica": "^7 || ^8", "symfony/mailer": "^5.4 || ^6", "symfony/mime": "^5.4 || ^6" }, @@ -1140,7 +1051,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.6.0" + "source": "https://github.com/Seldaek/monolog/tree/3.9.0" }, "funding": [ { @@ -1152,20 +1063,20 @@ "type": "tidelift" } ], - "time": "2024-04-12T21:02:21+00:00" + "time": "2025-03-24T10:02:05+00:00" }, { "name": "nesbot/carbon", - "version": "2.72.3", + "version": "2.73.0", "source": { "type": "git", - "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "0c6fd108360c562f6e4fd1dedb8233b423e91c83" + "url": "https://github.com/CarbonPHP/carbon.git", + "reference": "9228ce90e1035ff2f0db84b40ec2e023ed802075" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/0c6fd108360c562f6e4fd1dedb8233b423e91c83", - "reference": "0c6fd108360c562f6e4fd1dedb8233b423e91c83", + "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/9228ce90e1035ff2f0db84b40ec2e023ed802075", + "reference": "9228ce90e1035ff2f0db84b40ec2e023ed802075", "shasum": "" }, "require": { @@ -1185,7 +1096,7 @@ "doctrine/orm": "^2.7 || ^3.0", "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", - "ondrejmirtes/better-reflection": "*", + "ondrejmirtes/better-reflection": "<6", "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^0.12.99 || ^1.7.14", @@ -1198,10 +1109,6 @@ ], "type": "library", "extra": { - "branch-alias": { - "dev-3.x": "3.x-dev", - "dev-master": "2.x-dev" - }, "laravel": { "providers": [ "Carbon\\Laravel\\ServiceProvider" @@ -1211,6 +1118,10 @@ "includes": [ "extension.neon" ] + }, + "branch-alias": { + "dev-2.x": "2.x-dev", + "dev-master": "3.x-dev" } }, "autoload": { @@ -1259,7 +1170,7 @@ "type": "tidelift" } ], - "time": "2024-01-25T10:35:09+00:00" + "time": "2025-01-08T20:10:23+00:00" }, { "name": "nette/finder", @@ -1483,16 +1394,16 @@ }, { "name": "nyholm/psr7", - "version": "1.8.1", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/Nyholm/psr7.git", - "reference": "aa5fc277a4f5508013d571341ade0c3886d4d00e" + "reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Nyholm/psr7/zipball/aa5fc277a4f5508013d571341ade0c3886d4d00e", - "reference": "aa5fc277a4f5508013d571341ade0c3886d4d00e", + "url": "https://api.github.com/repos/Nyholm/psr7/zipball/a71f2b11690f4b24d099d6b16690a90ae14fc6f3", + "reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3", "shasum": "" }, "require": { @@ -1545,7 +1456,7 @@ ], "support": { "issues": "https://github.com/Nyholm/psr7/issues", - "source": "https://github.com/Nyholm/psr7/tree/1.8.1" + "source": "https://github.com/Nyholm/psr7/tree/1.8.2" }, "funding": [ { @@ -1557,7 +1468,7 @@ "type": "github" } ], - "time": "2023-11-13T09:31:12+00:00" + "time": "2024-09-09T07:06:30+00:00" }, { "name": "nyholm/psr7-server", @@ -1627,21 +1538,21 @@ }, { "name": "odan/session", - "version": "6.1.0", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/odan/session.git", - "reference": "b30e66903ab2cfa012c1d6c49b9bb11caa4c9f57" + "reference": "632366f11acb70cdfdcff1280684584a36d6b59c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/odan/session/zipball/b30e66903ab2cfa012c1d6c49b9bb11caa4c9f57", - "reference": "b30e66903ab2cfa012c1d6c49b9bb11caa4c9f57", + "url": "https://api.github.com/repos/odan/session/zipball/632366f11acb70cdfdcff1280684584a36d6b59c", + "reference": "632366f11acb70cdfdcff1280684584a36d6b59c", "shasum": "" }, "require": { - "php": "^8.0", - "psr/http-message": "^1", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0", + "psr/http-message": "^1 || ^2", "psr/http-server-handler": "^1", "psr/http-server-middleware": "^1" }, @@ -1649,13 +1560,9 @@ "friendsofphp/php-cs-fixer": "^3", "middlewares/utils": "^3", "nyholm/psr7": "^1.5", - "phpstan/phpstan": "^1", - "phpunit/phpunit": "^7 || ^8 || ^9 || ^10", - "squizlabs/php_codesniffer": "^3", - "symfony/console": "6.0.*", - "symfony/event-dispatcher": "6.0.*", - "symfony/filesystem": "6.0.*", - "symfony/finder": "6.0.*" + "phpstan/phpstan": "^2", + "phpunit/phpunit": "^11", + "squizlabs/php_codesniffer": "^3" }, "type": "library", "autoload": { @@ -1675,22 +1582,22 @@ ], "support": { "issues": "https://github.com/odan/session/issues", - "source": "https://github.com/odan/session/tree/6.1.0" + "source": "https://github.com/odan/session/tree/6.3.0" }, - "time": "2023-01-22T10:40:26+00:00" + "time": "2024-12-15T13:21:05+00:00" }, { "name": "phpmailer/phpmailer", - "version": "v6.9.1", + "version": "v6.10.0", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "039de174cd9c17a8389754d3b877a2ed22743e18" + "reference": "bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/039de174cd9c17a8389754d3b877a2ed22743e18", - "reference": "039de174cd9c17a8389754d3b877a2ed22743e18", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144", + "reference": "bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144", "shasum": "" }, "require": { @@ -1750,7 +1657,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.9.1" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.10.0" }, "funding": [ { @@ -1758,7 +1665,7 @@ "type": "github" } ], - "time": "2023-11-25T22:23:28+00:00" + "time": "2025-04-24T15:19:31+00:00" }, { "name": "psr/clock", @@ -1863,20 +1770,20 @@ }, { "name": "psr/http-factory", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "e616d01114759c4c489f93b099585439f795fe35" + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", - "reference": "e616d01114759c4c489f93b099585439f795fe35", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": ">=7.0.0", + "php": ">=7.1", "psr/http-message": "^1.0 || ^2.0" }, "type": "library", @@ -1900,7 +1807,7 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interfaces for PSR-7 HTTP message factories", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ "factory", "http", @@ -1912,22 +1819,22 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/1.0.2" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2023-04-10T20:10:41+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { "name": "psr/http-message", - "version": "1.1", + "version": "2.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { @@ -1936,7 +1843,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1951,7 +1858,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -1965,9 +1872,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/1.1" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2023-04-04T09:50:52+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { "name": "psr/http-server-handler", @@ -2084,16 +1991,16 @@ }, { "name": "psr/log", - "version": "3.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { @@ -2128,9 +2035,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { "name": "psr/simple-cache", @@ -2239,26 +2146,26 @@ }, { "name": "respect/validation", - "version": "2.3.7", + "version": "2.4.3", "source": { "type": "git", "url": "https://github.com/Respect/Validation.git", - "reference": "967f7b6cc71e3728bb0f766cc1aea0604b2955aa" + "reference": "7f4b3b3ec3ccdf330dfc4567bb43698018f3562a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Respect/Validation/zipball/967f7b6cc71e3728bb0f766cc1aea0604b2955aa", - "reference": "967f7b6cc71e3728bb0f766cc1aea0604b2955aa", + "url": "https://api.github.com/repos/Respect/Validation/zipball/7f4b3b3ec3ccdf330dfc4567bb43698018f3562a", + "reference": "7f4b3b3ec3ccdf330dfc4567bb43698018f3562a", "shasum": "" }, "require": { - "php": "^8.1 || ^8.2", + "php": ">=8.1", "respect/stringifier": "^0.2.0", "symfony/polyfill-mbstring": "^1.2" }, "require-dev": { "egulias/email-validator": "^3.0", - "giggsey/libphonenumber-for-php-lite": "^8.13", + "giggsey/libphonenumber-for-php-lite": "^8.13 || ^9.0", "malukenho/docheader": "^1.0", "mikey179/vfsstream": "^1.6", "phpstan/phpstan": "^1.9", @@ -2301,22 +2208,22 @@ ], "support": { "issues": "https://github.com/Respect/Validation/issues", - "source": "https://github.com/Respect/Validation/tree/2.3.7" + "source": "https://github.com/Respect/Validation/tree/2.4.3" }, - "time": "2024-04-13T09:45:55+00:00" + "time": "2025-05-14T12:14:59+00:00" }, { "name": "smarty/smarty", - "version": "v4.5.2", + "version": "v4.5.5", "source": { "type": "git", "url": "https://github.com/smarty-php/smarty.git", - "reference": "732040276609d0c3ad3381781c7444e7c5df9456" + "reference": "c4851c12e34ff80073ddeb7d98b059d57dea9de2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/smarty-php/smarty/zipball/732040276609d0c3ad3381781c7444e7c5df9456", - "reference": "732040276609d0c3ad3381781c7444e7c5df9456", + "url": "https://api.github.com/repos/smarty-php/smarty/zipball/c4851c12e34ff80073ddeb7d98b059d57dea9de2", + "reference": "c4851c12e34ff80073ddeb7d98b059d57dea9de2", "shasum": "" }, "require": { @@ -2367,81 +2274,22 @@ "support": { "forum": "https://github.com/smarty-php/smarty/discussions", "issues": "https://github.com/smarty-php/smarty/issues", - "source": "https://github.com/smarty-php/smarty/tree/v4.5.2" - }, - "time": "2024-04-05T22:34:05+00:00" - }, - { - "name": "spatie/ssh", - "version": "1.10.1", - "source": { - "type": "git", - "url": "https://github.com/spatie/ssh.git", - "reference": "8a69221ec27112bf463e6da78b21f17c047abd75" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/ssh/zipball/8a69221ec27112bf463e6da78b21f17c047abd75", - "reference": "8a69221ec27112bf463e6da78b21f17c047abd75", - "shasum": "" - }, - "require": { - "php": "^7.4|^8.0", - "symfony/process": "^4.4|^5.3|^6.0|^7.0" - }, - "require-dev": { - "pestphp/pest": "^1.22", - "spatie/pest-plugin-snapshots": "^1.1", - "symfony/var-dumper": "^5.3|6.0|^7.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Spatie\\Ssh\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Freek Van der Herten", - "email": "freek@spatie.be", - "homepage": "https://spatie.be", - "role": "Developer" - } - ], - "description": "A lightweight package to execute commands over an SSH connection", - "homepage": "https://github.com/spatie/ssh", - "keywords": [ - "spatie", - "ssh" - ], - "support": { - "issues": "https://github.com/spatie/ssh/issues", - "source": "https://github.com/spatie/ssh/tree/1.10.1" + "source": "https://github.com/smarty-php/smarty/tree/v4.5.5" }, - "funding": [ - { - "url": "https://spatie.be/open-source/support-us", - "type": "custom" - } - ], - "time": "2024-04-05T09:15:00+00:00" + "time": "2024-11-21T22:06:22+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.5.0", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", "shasum": "" }, "require": { @@ -2449,12 +2297,12 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" } }, "autoload": { @@ -2479,7 +2327,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" }, "funding": [ { @@ -2495,20 +2343,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/http-foundation", - "version": "v6.4.7", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "b4db6b833035477cb70e18d0ae33cb7c2b521759" + "reference": "452d19f945ee41345fd8a50c18b60783546b7bd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/b4db6b833035477cb70e18d0ae33cb7c2b521759", - "reference": "b4db6b833035477cb70e18d0ae33cb7c2b521759", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/452d19f945ee41345fd8a50c18b60783546b7bd3", + "reference": "452d19f945ee41345fd8a50c18b60783546b7bd3", "shasum": "" }, "require": { @@ -2518,12 +2366,12 @@ "symfony/polyfill-php83": "^1.27" }, "conflict": { - "symfony/cache": "<6.3" + "symfony/cache": "<6.4.12|>=7.0,<7.1.5" }, "require-dev": { "doctrine/dbal": "^2.13.1|^3|^4", "predis/predis": "^1.1|^2.0", - "symfony/cache": "^6.3|^7.0", + "symfony/cache": "^6.4.12|^7.1.5", "symfony/dependency-injection": "^5.4|^6.0|^7.0", "symfony/expression-language": "^5.4|^6.0|^7.0", "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4|^7.0", @@ -2556,7 +2404,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.4.7" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.23" }, "funding": [ { @@ -2572,24 +2420,25 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2025-05-26T09:17:58+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.29.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", "shasum": "" }, "require": { - "php": ">=7.1" + "ext-iconv": "*", + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -2600,8 +2449,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -2636,7 +2485,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0" }, "funding": [ { @@ -2652,30 +2501,30 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-12-23T08:48:59+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.29.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608", + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -2716,7 +2565,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0" }, "funding": [ { @@ -2732,31 +2581,30 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2025-01-02T08:10:11+00:00" }, { "name": "symfony/polyfill-php83", - "version": "v1.29.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php83.git", - "reference": "86fcae159633351e5fd145d1c47de6c528f8caff" + "reference": "2fb86d65e2d424369ad2905e83b236a8805ba491" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/86fcae159633351e5fd145d1c47de6c528f8caff", - "reference": "86fcae159633351e5fd145d1c47de6c528f8caff", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/2fb86d65e2d424369ad2905e83b236a8805ba491", + "reference": "2fb86d65e2d424369ad2905e83b236a8805ba491", "shasum": "" }, "require": { - "php": ">=7.1", - "symfony/polyfill-php80": "^1.14" + "php": ">=7.2" }, "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -2793,68 +2641,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.29.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, - { - "name": "symfony/process", - "version": "v6.4.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "cdb1c81c145fd5aa9b0038bab694035020943381" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/cdb1c81c145fd5aa9b0038bab694035020943381", - "reference": "cdb1c81c145fd5aa9b0038bab694035020943381", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Executes commands in sub-processes", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/process/tree/v6.4.7" + "source": "https://github.com/symfony/polyfill-php83/tree/v1.32.0" }, "funding": [ { @@ -2870,20 +2657,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/translation", - "version": "v6.4.7", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "7495687c58bfd88b7883823747b0656d90679123" + "reference": "de8afa521e04a5220e9e58a1dc99971ab7cac643" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/7495687c58bfd88b7883823747b0656d90679123", - "reference": "7495687c58bfd88b7883823747b0656d90679123", + "url": "https://api.github.com/repos/symfony/translation/zipball/de8afa521e04a5220e9e58a1dc99971ab7cac643", + "reference": "de8afa521e04a5220e9e58a1dc99971ab7cac643", "shasum": "" }, "require": { @@ -2949,7 +2736,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.4.7" + "source": "https://github.com/symfony/translation/tree/v6.4.23" }, "funding": [ { @@ -2965,20 +2752,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2025-06-26T21:24:02+00:00" }, { "name": "symfony/translation-contracts", - "version": "v3.5.0", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "b9d2189887bb6b2e0367a9fc7136c5239ab9b05a" + "reference": "df210c7a2573f1913b2d17cc95f90f53a73d8f7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/b9d2189887bb6b2e0367a9fc7136c5239ab9b05a", - "reference": "b9d2189887bb6b2e0367a9fc7136c5239ab9b05a", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/df210c7a2573f1913b2d17cc95f90f53a73d8f7d", + "reference": "df210c7a2573f1913b2d17cc95f90f53a73d8f7d", "shasum": "" }, "require": { @@ -2986,12 +2773,12 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" } }, "autoload": { @@ -3027,7 +2814,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/translation-contracts/tree/v3.6.0" }, "funding": [ { @@ -3043,20 +2830,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-27T08:32:26+00:00" }, { "name": "voku/portable-ascii", - "version": "2.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/voku/portable-ascii.git", - "reference": "b56450eed252f6801410d810c8e1727224ae0743" + "reference": "b1d923f88091c6bf09699efcd7c8a1b1bfd7351d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/voku/portable-ascii/zipball/b56450eed252f6801410d810c8e1727224ae0743", - "reference": "b56450eed252f6801410d810c8e1727224ae0743", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/b1d923f88091c6bf09699efcd7c8a1b1bfd7351d", + "reference": "b1d923f88091c6bf09699efcd7c8a1b1bfd7351d", "shasum": "" }, "require": { @@ -3081,7 +2868,7 @@ "authors": [ { "name": "Lars Moelleken", - "homepage": "http://www.moelleken.org/" + "homepage": "https://www.moelleken.org/" } ], "description": "Portable ASCII library - performance optimized (ascii) string functions for php.", @@ -3093,7 +2880,7 @@ ], "support": { "issues": "https://github.com/voku/portable-ascii/issues", - "source": "https://github.com/voku/portable-ascii/tree/2.0.1" + "source": "https://github.com/voku/portable-ascii/tree/2.0.3" }, "funding": [ { @@ -3117,34 +2904,106 @@ "type": "tidelift" } ], - "time": "2022-03-08T17:03:00+00:00" + "time": "2024-11-21T01:49:47+00:00" } ], "packages-dev": [ + { + "name": "clue/ndjson-react", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/clue/reactphp-ndjson.git", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Clue\\React\\NDJson\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + } + ], + "description": "Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.", + "homepage": "https://github.com/clue/reactphp-ndjson", + "keywords": [ + "NDJSON", + "json", + "jsonlines", + "newline", + "reactphp", + "streaming" + ], + "support": { + "issues": "https://github.com/clue/reactphp-ndjson/issues", + "source": "https://github.com/clue/reactphp-ndjson/tree/v1.3.0" + }, + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-12-23T10:58:28+00:00" + }, { "name": "composer/pcre", - "version": "3.1.3", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8" + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", - "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, "require-dev": { - "phpstan/phpstan": "^1.3", - "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" }, "type": "library", "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, "branch-alias": { "dev-main": "3.x-dev" } @@ -3174,7 +3033,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.3" + "source": "https://github.com/composer/pcre/tree/3.3.2" }, "funding": [ { @@ -3190,28 +3049,28 @@ "type": "tidelift" } ], - "time": "2024-03-19T10:26:25+00:00" + "time": "2024-11-12T16:29:46+00:00" }, { "name": "composer/semver", - "version": "3.4.0", + "version": "3.4.3", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", + "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1.4", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" }, "type": "library", "extra": { @@ -3255,7 +3114,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.0" + "source": "https://github.com/composer/semver/tree/3.4.3" }, "funding": [ { @@ -3271,20 +3130,20 @@ "type": "tidelift" } ], - "time": "2023-08-31T09:50:34+00:00" + "time": "2024-09-19T14:15:21+00:00" }, { "name": "composer/xdebug-handler", - "version": "3.0.4", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "4f988f8fdf580d53bdb2d1278fe93d1ed5462255" + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/4f988f8fdf580d53bdb2d1278fe93d1ed5462255", - "reference": "4f988f8fdf580d53bdb2d1278fe93d1ed5462255", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", "shasum": "" }, "require": { @@ -3321,7 +3180,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/3.0.4" + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" }, "funding": [ { @@ -3337,7 +3196,7 @@ "type": "tidelift" } ], - "time": "2024-03-26T18:29:49+00:00" + "time": "2024-05-06T16:37:16+00:00" }, { "name": "doctrine/instantiator", @@ -3410,69 +3269,188 @@ "time": "2022-12-30T00:23:10+00:00" }, { - "name": "friendsofphp/php-cs-fixer", - "version": "v3.54.0", + "name": "evenement/evenement", + "version": "v3.0.2", "source": { "type": "git", - "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "2aecbc8640d7906c38777b3dcab6f4ca79004d08" + "url": "https://github.com/igorw/evenement.git", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/2aecbc8640d7906c38777b3dcab6f4ca79004d08", - "reference": "2aecbc8640d7906c38777b3dcab6f4ca79004d08", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", "shasum": "" }, "require": { - "composer/semver": "^3.4", - "composer/xdebug-handler": "^3.0.3", - "ext-filter": "*", - "ext-json": "*", - "ext-tokenizer": "*", - "php": "^7.4 || ^8.0", - "sebastian/diff": "^4.0 || ^5.0 || ^6.0", - "symfony/console": "^5.4 || ^6.0 || ^7.0", - "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", - "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", - "symfony/finder": "^5.4 || ^6.0 || ^7.0", - "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", - "symfony/polyfill-mbstring": "^1.28", - "symfony/polyfill-php80": "^1.28", - "symfony/polyfill-php81": "^1.28", - "symfony/process": "^5.4 || ^6.0 || ^7.0", - "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" + "php": ">=7.0" }, "require-dev": { - "facile-it/paraunit": "^1.3 || ^2.0", - "infection/infection": "^0.27.11", - "justinrainbow/json-schema": "^5.2", - "keradus/cli-executor": "^2.1", - "mikey179/vfsstream": "^1.6.11", - "php-coveralls/php-coveralls": "^2.7", - "php-cs-fixer/accessible-object": "^1.1", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4", - "phpunit/phpunit": "^9.6 || ^10.5.5 || ^11.0.2", - "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0", - "symfony/yaml": "^5.4 || ^6.0 || ^7.0" - }, - "suggest": { - "ext-dom": "For handling output formats in XML", - "ext-mbstring": "For handling non-UTF8 characters." + "phpunit/phpunit": "^9 || ^6" }, - "bin": [ - "php-cs-fixer" - ], - "type": "application", + "type": "library", "autoload": { "psr-4": { - "PhpCsFixer\\": "src/" + "Evenement\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], + "authors": [ + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "Événement is a very simple event dispatching library for PHP", + "keywords": [ + "event-dispatcher", + "event-emitter" + ], + "support": { + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/v3.0.2" + }, + "time": "2023-08-08T05:53:35+00:00" + }, + { + "name": "fidry/cpu-core-counter", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "8520451a140d3f46ac33042715115e290cf5785f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/8520451a140d3f46ac33042715115e290cf5785f", + "reference": "8520451a140d3f46ac33042715115e290cf5785f", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^1.9.2", + "phpstan/phpstan-deprecation-rules": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.2.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2024-08-06T10:04:20+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v3.75.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "399a128ff2fdaf4281e4e79b755693286cdf325c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/399a128ff2fdaf4281e4e79b755693286cdf325c", + "reference": "399a128ff2fdaf4281e4e79b755693286cdf325c", + "shasum": "" + }, + "require": { + "clue/ndjson-react": "^1.0", + "composer/semver": "^3.4", + "composer/xdebug-handler": "^3.0.3", + "ext-filter": "*", + "ext-hash": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "fidry/cpu-core-counter": "^1.2", + "php": "^7.4 || ^8.0", + "react/child-process": "^0.6.5", + "react/event-loop": "^1.0", + "react/promise": "^2.0 || ^3.0", + "react/socket": "^1.0", + "react/stream": "^1.0", + "sebastian/diff": "^4.0 || ^5.1 || ^6.0 || ^7.0", + "symfony/console": "^5.4 || ^6.4 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.4 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.4 || ^7.0", + "symfony/finder": "^5.4 || ^6.4 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.4 || ^7.0", + "symfony/polyfill-mbstring": "^1.31", + "symfony/polyfill-php80": "^1.31", + "symfony/polyfill-php81": "^1.31", + "symfony/process": "^5.4 || ^6.4 || ^7.2", + "symfony/stopwatch": "^5.4 || ^6.4 || ^7.0" + }, + "require-dev": { + "facile-it/paraunit": "^1.3.1 || ^2.6", + "infection/infection": "^0.29.14", + "justinrainbow/json-schema": "^5.3 || ^6.2", + "keradus/cli-executor": "^2.1", + "mikey179/vfsstream": "^1.6.12", + "php-coveralls/php-coveralls": "^2.7", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6", + "phpunit/phpunit": "^9.6.22 || ^10.5.45 || ^11.5.12", + "symfony/var-dumper": "^5.4.48 || ^6.4.18 || ^7.2.3", + "symfony/yaml": "^5.4.45 || ^6.4.18 || ^7.2.3" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + }, + "exclude-from-classmap": [ + "src/Fixer/Internal/*" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], "authors": [ { "name": "Fabien Potencier", @@ -3492,7 +3470,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.54.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.75.0" }, "funding": [ { @@ -3500,20 +3478,20 @@ "type": "github" } ], - "time": "2024-04-17T08:12:13+00:00" + "time": "2025-03-31T18:40:42+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.13.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c", + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c", "shasum": "" }, "require": { @@ -3521,11 +3499,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -3551,7 +3530,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.1" }, "funding": [ { @@ -3559,7 +3538,7 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2025-04-29T12:36:36+00:00" }, { "name": "n98/junit-xml", @@ -3603,16 +3582,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.0.2", + "version": "v5.5.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "ae59794362fe85e051a58ad36b289443f57be7a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ae59794362fe85e051a58ad36b289443f57be7a9", + "reference": "ae59794362fe85e051a58ad36b289443f57be7a9", "shasum": "" }, "require": { @@ -3623,7 +3602,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -3655,9 +3634,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.5.0" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2025-05-31T08:24:38+00:00" }, { "name": "overtrue/phplint", @@ -3854,16 +3833,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.67", + "version": "1.12.27", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493" + "reference": "3a6e423c076ab39dfedc307e2ac627ef579db162" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/16ddbe776f10da6a95ebd25de7c1dbed397dc493", - "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a6e423c076ab39dfedc307e2ac627ef579db162", + "reference": "3a6e423c076ab39dfedc307e2ac627ef579db162", "shasum": "" }, "require": { @@ -3908,39 +3887,39 @@ "type": "github" } ], - "time": "2024-04-16T07:22:02+00:00" + "time": "2025-05-21T20:51:45+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.31", + "version": "9.2.32", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.18 || ^5.0", + "nikic/php-parser": "^4.19.1 || ^5.1.0", "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-text-template": "^2.0.4", + "sebastian/code-unit-reverse-lookup": "^2.0.3", + "sebastian/complexity": "^2.0.3", + "sebastian/environment": "^5.1.5", + "sebastian/lines-of-code": "^1.0.4", + "sebastian/version": "^3.0.2", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.6" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -3949,7 +3928,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "9.2.x-dev" } }, "autoload": { @@ -3978,7 +3957,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" }, "funding": [ { @@ -3986,7 +3965,7 @@ "type": "github" } ], - "time": "2024-03-02T06:37:42+00:00" + "time": "2024-08-22T04:23:01+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4231,45 +4210,45 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.19", + "version": "9.6.23", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" + "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", + "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", + "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.13.1", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.28", - "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-code-coverage": "^9.2.32", + "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", + "phpunit/php-text-template": "^2.0.4", + "phpunit/php-timer": "^5.0.3", + "sebastian/cli-parser": "^1.0.2", + "sebastian/code-unit": "^1.0.8", "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", + "sebastian/diff": "^4.0.6", + "sebastian/environment": "^5.1.5", + "sebastian/exporter": "^4.0.6", + "sebastian/global-state": "^5.0.7", + "sebastian/object-enumerator": "^4.0.4", + "sebastian/resource-operations": "^3.0.4", + "sebastian/type": "^3.2.1", "sebastian/version": "^3.0.2" }, "suggest": { @@ -4314,7 +4293,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.23" }, "funding": [ { @@ -4325,12 +4304,20 @@ "url": "https://github.com/sebastianbergmann", "type": "github" }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, { "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", "type": "tidelift" } ], - "time": "2024-04-05T04:35:58+00:00" + "time": "2025-05-02T06:40:34+00:00" }, { "name": "psr/event-dispatcher", @@ -4382,6 +4369,532 @@ }, "time": "2019-01-08T18:20:26+00:00" }, + { + "name": "react/cache", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2022-11-30T15:59:55+00:00" + }, + { + "name": "react/child-process", + "version": "v0.6.6", + "source": { + "type": "git", + "url": "https://github.com/reactphp/child-process.git", + "reference": "1721e2b93d89b745664353b9cfc8f155ba8a6159" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/1721e2b93d89b745664353b9cfc8f155ba8a6159", + "reference": "1721e2b93d89b745664353b9cfc8f155ba8a6159", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/socket": "^1.16", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\ChildProcess\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven library for executing child processes with ReactPHP.", + "keywords": [ + "event-driven", + "process", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.6" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-01-01T16:37:48+00:00" + }, + { + "name": "react/dns", + "version": "v1.13.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.13.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-13T14:18:03+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.5.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-11-13T13:48:05+00:00" + }, + { + "name": "react/promise", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.10.39 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-05-24T10:39:05+00:00" + }, + { + "name": "react/socket", + "version": "v1.16.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.13", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3.3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.16.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-07-26T10:38:09+00:00" + }, + { + "name": "react/stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-11T12:45:25+00:00" + }, { "name": "sebastian/cli-parser", "version": "1.0.2", @@ -5347,16 +5860,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.2", + "version": "3.13.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" + "reference": "5b5e3821314f947dd040c70f7992a64eac89025c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5b5e3821314f947dd040c70f7992a64eac89025c", + "reference": "5b5e3821314f947dd040c70f7992a64eac89025c", "shasum": "" }, "require": { @@ -5421,22 +5934,26 @@ { "url": "https://opencollective.com/php_codesniffer", "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" } ], - "time": "2024-04-23T20:25:34+00:00" + "time": "2025-06-17T22:17:01+00:00" }, { "name": "symfony/console", - "version": "v6.4.7", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f" + "reference": "9056771b8eca08d026cd3280deeec3cfd99c4d93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", - "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", + "url": "https://api.github.com/repos/symfony/console/zipball/9056771b8eca08d026cd3280deeec3cfd99c4d93", + "reference": "9056771b8eca08d026cd3280deeec3cfd99c4d93", "shasum": "" }, "require": { @@ -5501,7 +6018,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.7" + "source": "https://github.com/symfony/console/tree/v6.4.23" }, "funding": [ { @@ -5517,20 +6034,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2025-06-27T19:37:22+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v7.0.7", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "db2a7fab994d67d92356bb39c367db115d9d30f9" + "reference": "497f73ac996a598c92409b44ac43b6690c4f666d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/db2a7fab994d67d92356bb39c367db115d9d30f9", - "reference": "db2a7fab994d67d92356bb39c367db115d9d30f9", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/497f73ac996a598c92409b44ac43b6690c4f666d", + "reference": "497f73ac996a598c92409b44ac43b6690c4f666d", "shasum": "" }, "require": { @@ -5581,7 +6098,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v7.0.7" + "source": "https://github.com/symfony/event-dispatcher/tree/v7.3.0" }, "funding": [ { @@ -5597,20 +6114,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2025-04-22T09:11:45+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.5.0", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50" + "reference": "59eb412e93815df44f05f342958efa9f46b1e586" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/8f93aec25d41b72493c6ddff14e916177c9efc50", - "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/59eb412e93815df44f05f342958efa9f46b1e586", + "reference": "59eb412e93815df44f05f342958efa9f46b1e586", "shasum": "" }, "require": { @@ -5619,12 +6136,12 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" } }, "autoload": { @@ -5657,7 +6174,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.6.0" }, "funding": [ { @@ -5673,26 +6190,28 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/filesystem", - "version": "v7.0.7", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "cc168be6fbdcdf3401f50ae863ee3818ed4338f5" + "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/cc168be6fbdcdf3401f50ae863ee3818ed4338f5", - "reference": "cc168be6fbdcdf3401f50ae863ee3818ed4338f5", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b8dce482de9d7c9fe2891155035a7248ab5c7fdb", + "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb", "shasum": "" }, "require": { "php": ">=8.2", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-mbstring": "~1.8" + }, + "require-dev": { "symfony/process": "^6.4|^7.0" }, "type": "library", @@ -5721,7 +6240,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.0.7" + "source": "https://github.com/symfony/filesystem/tree/v7.3.0" }, "funding": [ { @@ -5737,20 +6256,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-10-25T15:15:23+00:00" }, { "name": "symfony/finder", - "version": "v6.4.7", + "version": "v6.4.17", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "511c48990be17358c23bf45c5d71ab85d40fb764" + "reference": "1d0e8266248c5d9ab6a87e3789e6dc482af3c9c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/511c48990be17358c23bf45c5d71ab85d40fb764", - "reference": "511c48990be17358c23bf45c5d71ab85d40fb764", + "url": "https://api.github.com/repos/symfony/finder/zipball/1d0e8266248c5d9ab6a87e3789e6dc482af3c9c7", + "reference": "1d0e8266248c5d9ab6a87e3789e6dc482af3c9c7", "shasum": "" }, "require": { @@ -5785,7 +6304,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.4.7" + "source": "https://github.com/symfony/finder/tree/v6.4.17" }, "funding": [ { @@ -5801,20 +6320,20 @@ "type": "tidelift" } ], - "time": "2024-04-23T10:36:43+00:00" + "time": "2024-12-29T13:51:37+00:00" }, { "name": "symfony/options-resolver", - "version": "v7.0.7", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "23cc173858776ad451e31f053b1c9f47840b2cfa" + "reference": "afb9a8038025e5dbc657378bfab9198d75f10fca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/23cc173858776ad451e31f053b1c9f47840b2cfa", - "reference": "23cc173858776ad451e31f053b1c9f47840b2cfa", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/afb9a8038025e5dbc657378bfab9198d75f10fca", + "reference": "afb9a8038025e5dbc657378bfab9198d75f10fca", "shasum": "" }, "require": { @@ -5852,7 +6371,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v7.0.7" + "source": "https://github.com/symfony/options-resolver/tree/v7.3.0" }, "funding": [ { @@ -5868,24 +6387,24 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2025-04-04T13:12:05+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.29.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" @@ -5896,8 +6415,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -5931,7 +6450,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0" }, "funding": [ { @@ -5947,24 +6466,24 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.29.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" @@ -5972,8 +6491,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -6009,7 +6528,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.32.0" }, "funding": [ { @@ -6025,24 +6544,24 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.29.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" @@ -6050,8 +6569,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -6090,7 +6609,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.32.0" }, "funding": [ { @@ -6106,30 +6625,30 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.29.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "c565ad1e63f30e7477fc40738343c62b40bc672d" + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/c565ad1e63f30e7477fc40738343c62b40bc672d", - "reference": "c565ad1e63f30e7477fc40738343c62b40bc672d", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -6166,7 +6685,68 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.32.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/process", + "version": "v6.4.20", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "e2a61c16af36c9a07e5c9906498b73e091949a20" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/e2a61c16af36c9a07e5c9906498b73e091949a20", + "reference": "e2a61c16af36c9a07e5c9906498b73e091949a20", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v6.4.20" }, "funding": [ { @@ -6182,20 +6762,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2025-03-10T17:11:00+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.5.0", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" + "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4", + "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4", "shasum": "" }, "require": { @@ -6208,12 +6788,12 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" } }, "autoload": { @@ -6249,7 +6829,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.6.0" }, "funding": [ { @@ -6265,20 +6845,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2025-04-25T09:37:31+00:00" }, { "name": "symfony/stopwatch", - "version": "v7.0.7", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "41a7a24aa1dc82adf46a06bc292d1923acfe6b84" + "reference": "5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/41a7a24aa1dc82adf46a06bc292d1923acfe6b84", - "reference": "41a7a24aa1dc82adf46a06bc292d1923acfe6b84", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd", + "reference": "5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd", "shasum": "" }, "require": { @@ -6311,7 +6891,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v7.0.7" + "source": "https://github.com/symfony/stopwatch/tree/v7.3.0" }, "funding": [ { @@ -6327,20 +6907,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2025-02-24T10:49:57+00:00" }, { "name": "symfony/string", - "version": "v7.0.7", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63" + "reference": "f3570b8c61ca887a9e2938e85cb6458515d2b125" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e405b5424dc2528e02e31ba26b83a79fd4eb8f63", - "reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63", + "url": "https://api.github.com/repos/symfony/string/zipball/f3570b8c61ca887a9e2938e85cb6458515d2b125", + "reference": "f3570b8c61ca887a9e2938e85cb6458515d2b125", "shasum": "" }, "require": { @@ -6354,6 +6934,7 @@ "symfony/translation-contracts": "<2.5" }, "require-dev": { + "symfony/emoji": "^7.1", "symfony/error-handler": "^6.4|^7.0", "symfony/http-client": "^6.4|^7.0", "symfony/intl": "^6.4|^7.0", @@ -6397,7 +6978,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.0.7" + "source": "https://github.com/symfony/string/tree/v7.3.0" }, "funding": [ { @@ -6413,20 +6994,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2025-04-20T20:19:01+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.4.7", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "7a9cd977cd1c5fed3694bee52990866432af07d7" + "reference": "d55b1834cdbfcc31bc2cd7e095ba5ed9a88f6600" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7a9cd977cd1c5fed3694bee52990866432af07d7", - "reference": "7a9cd977cd1c5fed3694bee52990866432af07d7", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/d55b1834cdbfcc31bc2cd7e095ba5ed9a88f6600", + "reference": "d55b1834cdbfcc31bc2cd7e095ba5ed9a88f6600", "shasum": "" }, "require": { @@ -6482,7 +7063,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.7" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.23" }, "funding": [ { @@ -6498,20 +7079,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2025-06-27T15:05:27+00:00" }, { "name": "symfony/yaml", - "version": "v6.4.7", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "53e8b1ef30a65f78eac60fddc5ee7ebbbdb1dee0" + "reference": "93e29e0deb5f1b2e360adfb389a20d25eb81a27b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/53e8b1ef30a65f78eac60fddc5ee7ebbbdb1dee0", - "reference": "53e8b1ef30a65f78eac60fddc5ee7ebbbdb1dee0", + "url": "https://api.github.com/repos/symfony/yaml/zipball/93e29e0deb5f1b2e360adfb389a20d25eb81a27b", + "reference": "93e29e0deb5f1b2e360adfb389a20d25eb81a27b", "shasum": "" }, "require": { @@ -6554,7 +7135,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.7" + "source": "https://github.com/symfony/yaml/tree/v6.4.23" }, "funding": [ { @@ -6570,37 +7151,37 @@ "type": "tidelift" } ], - "time": "2024-04-28T10:28:08+00:00" + "time": "2025-06-03T06:46:12+00:00" }, { "name": "symplify/coding-standard", - "version": "12.1.4", + "version": "12.1.6", "source": { "type": "git", "url": "https://github.com/symplify/coding-standard.git", - "reference": "1a591e18c64e7367b243729a43a70c2e92025468" + "reference": "2a261fe788e8c1e6f216490121b6942d8f7e313c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symplify/coding-standard/zipball/1a591e18c64e7367b243729a43a70c2e92025468", - "reference": "1a591e18c64e7367b243729a43a70c2e92025468", + "url": "https://api.github.com/repos/symplify/coding-standard/zipball/2a261fe788e8c1e6f216490121b6942d8f7e313c", + "reference": "2a261fe788e8c1e6f216490121b6942d8f7e313c", "shasum": "" }, "require": { - "friendsofphp/php-cs-fixer": "^3.49", + "friendsofphp/php-cs-fixer": "^3.59", "nette/utils": "^3.2", "php": ">=8.2", - "symplify/rule-doc-generator-contracts": "^11.1" + "symplify/rule-doc-generator-contracts": "^11.2" }, "require-dev": { - "phpstan/extension-installer": "^1.3", - "phpstan/phpstan": "^1.10.58", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^1.11", "phpunit/phpunit": "^10.5", - "rector/rector": "^1.0", - "squizlabs/php_codesniffer": "^3.8.1", - "symplify/easy-coding-standard": "^12.1", + "rector/rector": "^1.1", + "squizlabs/php_codesniffer": "^3.10.1", + "symplify/easy-coding-standard": "^12.3", "symplify/phpstan-extensions": "^11.4", - "symplify/rule-doc-generator": "^12.0", + "symplify/rule-doc-generator": "^12.2.2", "tomasvotruba/class-leak": "^0.2", "tracy/tracy": "^2.10" }, @@ -6617,7 +7198,7 @@ "description": "Set of Symplify rules for PHP_CodeSniffer and PHP CS Fixer.", "support": { "issues": "https://github.com/symplify/coding-standard/issues", - "source": "https://github.com/symplify/coding-standard/tree/12.1.4" + "source": "https://github.com/symplify/coding-standard/tree/12.1.6" }, "funding": [ { @@ -6629,20 +7210,20 @@ "type": "github" } ], - "time": "2024-02-23T13:07:31+00:00" + "time": "2024-06-28T14:19:31+00:00" }, { "name": "symplify/easy-coding-standard", - "version": "12.1.14", + "version": "12.5.20", "source": { "type": "git", "url": "https://github.com/easy-coding-standard/easy-coding-standard.git", - "reference": "e3c4a241ee36704f7cf920d5931f39693e64afd5" + "reference": "bb44b0fc70dd2148d8a6362bc66a35e23dc31bc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/e3c4a241ee36704f7cf920d5931f39693e64afd5", - "reference": "e3c4a241ee36704f7cf920d5931f39693e64afd5", + "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/bb44b0fc70dd2148d8a6362bc66a35e23dc31bc4", + "reference": "bb44b0fc70dd2148d8a6362bc66a35e23dc31bc4", "shasum": "" }, "require": { @@ -6653,6 +7234,9 @@ "phpcsstandards/php_codesniffer": "<3.8", "symplify/coding-standard": "<12.1" }, + "suggest": { + "ext-dom": "Needed to support checkstyle output format in class CheckstyleOutputFormatter" + }, "bin": [ "bin/ecs" ], @@ -6675,7 +7259,7 @@ ], "support": { "issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues", - "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.1.14" + "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.5.20" }, "funding": [ { @@ -6687,7 +7271,7 @@ "type": "github" } ], - "time": "2024-02-23T13:10:40+00:00" + "time": "2025-05-30T11:42:07+00:00" }, { "name": "symplify/rule-doc-generator-contracts", @@ -6801,12 +7385,12 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": "^8.2" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/adminator3/app/Core/shared/ros_api_qos.php b/adminator3/app/Core/shared/ros_api_qos.php deleted file mode 100644 index 6e51ae5ce..000000000 --- a/adminator3/app/Core/shared/ros_api_qos.php +++ /dev/null @@ -1,1317 +0,0 @@ -conn_mysql = $conn_mysql; - $this->rosClient = $rosClient; - $this->conn = $rosClient; - - //vytvorit pole pro garanty - $q = $this->conn_mysql->query( - "SELECT id_tarifu, zkratka_tarifu, speed_dwn, speed_upl - FROM tarify_int - WHERE (typ_tarifu = '0' AND garant = '1') - ORDER BY id_tarifu" - ); - - while ($data = $q->fetch_array()) { - $id = "objects_g_".$data["id_tarifu"]; - $this->objects_garants[$id] = $data["speed_dwn"].":".$data["speed_upl"]; - } - - } //end of function contsruct - - public function set_wanted_values($ip) - { - $this->controlled_router_ip = $ip; - - //ID zjistime z adminatora - $rs = $this->conn_mysql->query("SELECT id FROM router_list WHERE ip_adresa = '$ip'"); - $rs->data_seek(0); - list($this->controlled_router_id) = $rs->fetch_row(); - - if (!isset($this->controlled_router_id)) { - return false; - } - - } //end of function set_wanted_values - - public function find_version() - { - - //zjistit verzi ROSu - $resourceQuery = (new Query('/system/resource/print')); - $response = $this->rosClient->query($resourceQuery)->read(); - $this->ros_version = $response[0]['version']; - - if ($this->debug >= 1) { - echo " ros version: " . $this->ros_version . "
\n"; - } - - } //end of function find_version - - public function array_serialize($array) - { - - $aReturn = array(); - - foreach ($array as $key => $value) { - if (isset($value["limit-at"])) { - $value["limit-at"] = floatval($value["limit-at"]); - } - - if (isset($value["max-limit"])) { - $value["max-limit"] = floatval($value["max-limit"]); - } - - $serValue = serialize($value); - - $aReturn[$key] = $serValue; - } - - return $aReturn; - - } //end of function array_serialize - - - public function arrayDiff($aArray1, $aArray2) - { - - //priprava promenych - $aReturn = array(); - - $serArray1 = $this->array_serialize($aArray1); - $serArray2 = $this->array_serialize($aArray2); - - $diffArray = array_diff($serArray1, $serArray2); - - // echo "--- serArray1 --- \n".print_r($serArray1); - // echo "--- diffArray --- \n".print_r($diffArray)." \n"; - - foreach ($diffArray as $key => $value) { - $aReturn[$key] = ""; - } - - return $aReturn; - - } //end of function arrayRecursiveDiff - - public function find_root_router($id_routeru, $ip_adresa_routeru) - { - //zjitime si parent router - $rs = $this->conn_mysql->query("SELECT parent_router FROM router_list WHERE id = '$id_routeru'"); - $rs->data_seek(0); - list($parent_router_id) = $rs->fetch_row(); - - //zjistime IP-cko parent routeru - $rs2 = $this->conn_mysql->query("SELECT ip_adresa FROM router_list WHERE id = '$parent_router_id'"); - $rs2->data_seek(0); - list($parent_router_ip) = $rs2->fetch_row(); - - //DEBUG //print " id_r: ".$id_routeru.", p_r: ".$parent_router.", p_r_ip: ".$parent_router_ip." \n"; - - if ((($this->controlled_router_id == $this->reinhard_3_id) - or ($this->controlled_router_id == $this->reinhard_5_id)) - ) { - if ($parent_router_ip == $ip_adresa_routeru) { //dosahlo se pozadovaneho reinhard, tj. zaznam CHCEME - return true; - } elseif (($parent_router_id == $this->reinhard_wifi_id)) { //dosahlo se rh-wifi (zacatku stromu), a nechceme routery krz rh-wifi, tj. zaznam NECHCEME - - } else { - if ($this->find_root_router($parent_router_id, $ip_adresa_routeru) == true) { - return true; - } - } - } elseif ($this->controlled_router_id == $this->reinhard_wifi_id) { - - if (($parent_router_id == $this->reinhard_3_id) - or ($parent_router_id == $this->reinhard_fiber_id) - or ($parent_router_id == $this->reinhard_5_id) - ) { - //ve stromu jsme se dostali k rh-3 nebo rh-fiber (ty jsou bohuzel taky "pod" rh-wifi), tj. zaznam NECHCEM - } elseif (($id_routeru == $this->reinhard_3_id) - or ($id_routeru == $this->reinhard_fiber_id) - or ($id_routeru == $this->reinhard_5_id) - ) { - - } elseif ($parent_router_ip == $ip_adresa_routeru) { - return true; - } elseif ($parent_router_id == $this->reinhard_wifi_id) { - //dostali jsme se na vrchol, tj. rh-wifi, tj. zaznam CHCEME - } else { //ani jedno z predchozich, tj. rekurze - if ($this->find_root_router($parent_router_id, $ip_adresa_routeru) == true) { - return true; - } - } - } else { - //error, tento router neumim .. - echo "ERROR: pro tento router neumim najit parent router ... ". - "(debug: controlled router: id: ".$this->controlled_router_id. - ", ip: ".$this->controlled_router_ip.")
\n"; - - return false; - } - - } //end of function find_root_router - - public function find_obj($ip) - { - - $routers = array(); - $routers_ip = array(); - - //1. zjistit routery co jedou pres pozadovany reinhard - $rs_routers = $this->conn_mysql->query("SELECT id, parent_router, nazev, ip_adresa FROM router_list WHERE id > 1 ORDER BY id"); - $num_rs_routers = $rs_routers->num_rows; - - while ($data_routers = $rs_routers->fetch_array()) { - $id_routeru = $data_routers["id"]; - $ip_adresa = $data_routers["ip_adresa"]; - - if ($this->find_root_router($id_routeru, $ip) === true) { - $routers[] = $id_routeru; - $routers_ip[] = $ip_adresa; - } - } - - if (count($routers) < 1) { - echo "ros_api_qos\\find_obj: Error: no downstream/connected router(s) found!
\n"; - return false; - } else { - echo "ros_api_qos\\find_obj: INFO: found " . count($routers) . " router(s)
\n"; - } - - //debug print_r($routers_ip); - - //2. zjistit nody - $i = 0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if ($i == 0) { - $sql_where .= "'$id_routeru'"; - } else { - $sql_where .= ",'$id_routeru'"; - } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - print "DEBUG: SQL DUMP: " . $sql."
\n"; - - $rs_nods = $this->conn_mysql->query($sql); - $num_rs_nods = $rs_nods->num_rows; - - while ($data_nods = $rs_nods->fetch_array()) { - $nods[] = $data_nods["id"]; - } - - //3. zjistit lidi - $i = 0; - - foreach ($nods as $key => $id_nodu) { - //print "nods: ".$id_nodu." \n"; - - if ($i == 0) { - $sql_obj_where .= "'$id_nodu'"; - } else { - $sql_obj_where .= ",'$id_nodu'"; - } - - $i++; - } - - $sql_obj = "SELECT ip, id_tarifu, client_ap_ip FROM objekty WHERE id_nodu IN (".$sql_obj_where.") ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $rs_objects = pg_query($sql_obj); - $num_rs_objects = pg_num_rows($rs_objects); - - while ($data = pg_fetch_array($rs_objects)) { - $ip = $data["ip"]; - $client_ap_ip = $data["client_ap_ip"]; - - $this->objects[$ip] = $data["id_tarifu"]; - - if ((strlen($client_ap_ip) > 4)) { //vyplnena ip adresa apcka - - //zjistit zda-li uz neni - if (!(array_key_exists($client_ap_ip, $this->objects))) { - $this->objects[$client_ap_ip] = $this->id_tarifu_routers; - } - } - } - - //k seznamu ip adres pridame routery, taky chtej inet :) - foreach ($routers_ip as $key => $ip) { - - //zjistit zda uz IP adresa neni v objektu - if ((array_key_exists($ip, $this->objects))) { /* echo " object ".$ip." exists \n"; */ - } else { - $this->objects[$ip] = $this->id_tarifu_routers; - } - - } - - print " number of IP addresses via this router: ".count($this->objects); - - if ($this->debug == 1) { - echo ", count of array objects: ".count($this->objects)." "; - } - echo "\n"; - - } //end of function - - public function remove_wrong_items($wrong_items) - { - $item_del_ok = 0; - $item_del_err = 0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/mangle", $wrong_items); - - if ($del == "1") { - if ($this->debug > 0) { - echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; - } - $item_del_ok = count($wrong_items); - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($del)."\n"; - } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - public function detect_diff_in_mangle() - { - $this->getall_mangle = array(); - $this->arr_objects_dev_upl = array(); - $this->arr_objects_dev_dwn = array(); - - $this->getall_mangle = $this->conn->getall(array("ip", "firewall", "mangle")); - - /* - muster ROS 5.1 - - [0] => Array - ( - [.id] => *45FB - [chain] => forward - [action] => mark-packet - [new-packet-mark] => 10.1.3.13_dwn - [passthrough] => false - [dst-address] => 10.1.3.13 - [invalid] => false - [dynamic] => false - [disabled] => false - ) - - muster ROS 4.16 - - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_dwn"]."_dwn"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_dwn"] = $this->getall_mangle[$key]["$this->element_name_dwn"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - $mangle_muster["comment"] = ""; - - */ - - // print_r($this->getall_mangle); - /* - if( count($this->getall_mangle) > 0 ) { - print_r($this->getall_mangle); } - else { - echo " Array \"getall_mangle\" is empty \n"; } - */ - - //priprava zaznamu v routeru - foreach ($this->getall_mangle as $key => $value) { - - $ip_dwn = $this->getall_mangle["$key"]["$this->element_name_dwn"]; - $ip_upl = $this->getall_mangle["$key"]["$this->element_name_upl"]; - - if (isset($this->getall_mangle[$key]["$this->element_name_dwn"])) { - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_dwn"]."_dwn"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_dwn"] = $this->getall_mangle[$key]["$this->element_name_dwn"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - - if (($this->ros_version == "5.1") or ($this->ros_version == "5.6")) { /* chybi pole comment, kdyz je prazdne */ - } else { - $mangle_muster["comment"] = ""; - } - - /* - print "item muster \n"; - print_r($mangle_muster); - print "item from device \n"; - print_r($value); - */ - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if ((empty($diff1) and empty($diff2))) { - $this->arr_objects_dev_dwn[$ip_dwn] = $this->getall_mangle["$key"][".id"]; - } else { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]; - echo " (".$this->getall_mangle["$key"]["name"].") "; - echo " does not match the muster item. \n"; - print_r($diff1); - print_r($diff2); - - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - - //echo "adding: $ip -- $key\n"; - } elseif (isset($this->getall_mangle[$key]["$this->element_name_upl"])) { - - //definice pole, jak ma zaznam vypadat :) - $mangle_muster = array(); - $mangle_muster[".id"] = $this->getall_mangle["$key"][".id"]; - $mangle_muster["chain"] = $this->chain; //[chain] => prerouting - $mangle_muster["action"] = "mark-packet"; //[action] => mark-packet - $mangle_muster["new-packet-mark"] = $this->getall_mangle[$key]["$this->element_name_upl"]."_upl"; - $mangle_muster["passthrough"] = "false"; - $mangle_muster["$this->element_name_upl"] = $this->getall_mangle[$key]["$this->element_name_upl"]; - $mangle_muster["invalid"] = "false"; - $mangle_muster["dynamic"] = "false"; - $mangle_muster["disabled"] = "false"; - - if (($this->ros_version == "5.1") or ($this->ros_version == "5.6")) { /* chybi pole comment, kdyz je prazdne */ - } else { - $mangle_muster["comment"] = ""; - } - - //print_r($mangle_muster); - //print_r($value); - - $diff1 = array_diff($mangle_muster, $value); - $diff2 = array_diff($value, $mangle_muster); - - if ((empty($diff1) and empty($diff2))) { - $this->arr_objects_dev_upl[$ip_upl] = $this->getall_mangle["$key"][".id"]; - } else { - echo " ERROR: Item id: ".$this->getall_mangle["$key"][".id"]." does not match the muster item. \n"; - //print_r($diff1); print_r($diff2); - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - } - } else { - echo " WARNING: Nalezeno jiné pravidlo/nelze parsovat. (id: ".$this->getall_mangle["$key"][".id"].") \n"; - - //zde udelat seznam pravidel pro smazani :) - $this->wrong_firewall_items[] = $this->getall_mangle["$key"][".id"]; - - } //end of else if - } - - //print_r($arr_objects_dev_dwn); - //print_r($arr_objects_dev_upl); - - if ((count($this->wrong_firewall_items) > 0) && ($this->force_mangle_rewrite != 1)) { - $this->remove_wrong_items($this->wrong_firewall_items); - } - - if (!(is_array($this->arr_objects_dev_upl))) { - $this->arr_objects_dev_upl = array(); - } - - if (!(is_array($this->arr_objects_dev_dwn))) { - $this->arr_objects_dev_dwn = array(); - } - - $arr_obj_dev_diff = array_diff_key($this->arr_objects_dev_dwn, $this->arr_objects_dev_upl); - //print_r($arr_obj_dev_diff); - - $arr_obj_dev_diff2 = array_diff_key($this->arr_objects_dev_upl, $this->arr_objects_dev_dwn); - //print_r($arr_obj_dev_diff2); - - if ((count($arr_obj_dev_diff) > 0) or (count($arr_obj_dev_diff2) > 0)) { - echo " ERROR: Rozdilny pocet zaznamu pro DWN a UPL. Forcing a full sync... \n"; - $this->force_mangle_rewrite = 1; - } else { - echo " number of records : device: ".count($this->arr_objects_dev_dwn).", system: ".count($this->objects)."\n"; - - $this->arr_global_diff_exc = array_diff_key($this->arr_objects_dev_dwn, $this->objects); - $this->arr_global_diff_mis = array_diff_key($this->objects, $this->arr_objects_dev_dwn); - } - - } //end of function detect_diff_in_mangle - - public function erase_mangle() - { - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->getall_mangle as $key => $value) { - - /* - if(asi nejake vyjimky) - {} - else - */ - { - $erase[] = $this->getall_mangle[$key][".id"]; - //print "erasing id: ".$key."\n"; - } - - } //end of forearch - - $del = $this->conn->remove("/ip/firewall/mangle", $erase); - - if ($del == "1") { - if ($this->debug > 0) { - echo " Item(s) successfully deleted (".count($erase).")\n"; - } - $items_suc_del++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($del)."\n"; - } - $items_err_del++; - } - - print " result of force deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - //print_r($erase)."\n"; - - } //end of function erase_mangle - - public function synchro_mangle_force() - { - //reseni asi smazat vse a pak pustit synchro_mangle - $this->erase_mangle(); - - $this->detect_diff_in_mangle(); - - print " counts excess ip: ".count($this->arr_global_diff_exc).", missing ip: ".count($this->arr_global_diff_mis)."\n"; - - $this->synchro_mangle(); - - } //end of function synchro_mangle_force - - public function synchro_mangle() - { - - $items_suc_added = 0; - $items_err_added = 0; - - foreach ($this->arr_global_diff_mis as $ip => $value) { - - $add_par_r = array("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_dwn", - "$this->item_ip_dwn" => "$ip", "passthrough" => "no"); - $add = $this->conn->add("/ip/firewall/mangle", $add_par_r); - - if (ereg('^\*([[:xdigit:]])*$', $add)) { - if ($debug > 0) { - echo " Item ".$add." successfully added \n"; - } - $items_suc_added++; - } else { - if ($debug > 0) { - echo " ERROR: ".print_r($add)."\n"; - } - $items_err_added++; - } - - $add_par_r2 = array("chain" => $this->chain, "action" => "mark-packet", "disabled" => "no", "new-packet-mark" => $ip."_upl", - "$this->item_ip_upl" => "$ip", "passthrough" => "no"); - $add2 = $this->conn->add("/ip/firewall/mangle", $add_par_r2); - - if (ereg('^\*([[:xdigit:]])*$', $add2)) { - if ($debug > 0) { - echo " Item ".$add." successfully added \n"; - } - $items_suc_added++; - } else { - if ($debug > 0) { - echo " ERROR: ".print_r($add2)."\n"; - } - $items_err_added++; - print_r($add_par_r2); - } - - } //end of foreach $arr_global_diff_mis - - print " count of added items: ok: ".$items_suc_added.", error: ".$items_err_added."\n"; - - $items_suc_del = 0; - $items_err_del = 0; - - foreach ($this->arr_global_diff_exc as $ip => $value) { - - $index = $this->arr_objects_dev_dwn["$ip"]; - $index2 = $this->arr_objects_dev_upl["$ip"]; - - //echo " deleted: ".$ip.", v1: $index, v2: $index2 \n"; - - $del = $this->conn->remove("/ip/firewall/mangle", array("$index","$index2")); - - if ($del == "1") { - if ($debug > 0) { - echo " Item(s) successfully deleted (".$index.",".$index2.")\n"; - } - $items_suc_del++; - } else { - if ($debug > 0) { - echo " ERROR: ".print_r($del)."\n"; - } - $items_err_del++; - } - - } //end of foreach $arr_global_diff_mis - - print " count of deleted items: ok: ".$items_suc_del.", error: ".$items_err_del."\n"; - - - } //end of function synchro_mangle - - public function qt_global() - { - - //zjisteni agregace SC - $rs_agreg = mysql_query("SELECT agregace, speed_dwn, speed_upl FROM tarify_int WHERE id_tarifu = '1'"); - - while ($d_agreg = mysql_fetch_array($rs_agreg)) { - $this->agregace_sc = $d_agreg["agregace"]; - $this->speed_sc_dwn = $d_agreg["speed_dwn"]; - $this->speed_sc_upl = $d_agreg["speed_upl"]; - } - - foreach ($this->objects as $ip => $linka) { - - if ($linka == 1) { - $this->objects_sc[] = $ip; - } elseif ($linka == 0) { - $this->objects_mp[] = $ip; - } else { - if (array_key_exists("objects_g_".$linka, $this->objects_garants)) { - //echo " WARNING: garant: "."objects_g_".$linka.", ip> $ip \n"; - $this->{"objects_g_".$linka}[] = $ip; - } else { - //$this->objects_garants[] - echo " WARNING: Neznámá linka (".$linka.") u objektu: ".$ip."\n"; - } - } - } - - //zredukovat pole objects_garants, dle vyuziti - foreach ($this->objects_garants as $key => $value) { - - if ((count($this->{$key}) > 0)) { - $this->objects_garants_used[$key] = $value; - } - - } - - //print_r($this->objects_g_2); - //print_r($this->objects_garants_used); - - echo " qt(global) number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - - } - - public function qt_delete_all() - { - - $qt_suc_del = 0; - $qt_err_del = 0; - - $qt_del_all = $this->conn->getall(array("queue","tree")); - - foreach ($qt_del_all as $key => $value) { - - $qt_del_all_id[] = $qt_del_all[$key][".id"]; - - } - - $qt_del = $this->conn->remove("/queue/tree", $qt_del_all_id); - - if ($qt_del == "1") { - if ($this->debug > 0) { - echo " QT Item(s) successfully deleted (".count($qt_del_all_id).")\n"; - } - $qt_suc_del++; - } else { - if ($this->debug > 0) { - echo " QT ERROR: ".print_r($qt_del_all_id)."\n"; - } - $qt_err_del++; - } - - print " qt: deleted items ".count($qt_del_all_id).", ok: ".$qt_suc_del.", error: ".$qt_err_del."\n"; - - // print_r($qt_del_all_id); - - } - - public function erase_qt($array) - { - - $items_suc_del = 0; - $items_err_del = 0; - - $del = $this->conn->remove("/queue/tree", $array); - - if ($del == "1") { - if ($this->debug > 0) { - echo " Item(s) successfully deleted (".count($erase).")\n"; - } - $items_suc_del++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($del)."\n"; - } - $items_err_del++; - } - - echo " qt: count of deleted items: ".count($array).", status: "; - - if ($items_suc_del == 1) { - echo " OK "; - } elseif ($items_err_del == 1) { - echo " error "; - } else { - echo "unknown (ok: ".$items_suc_del.", error: ".$items_err_del.") "; - } - - echo "\n"; - - //print_r($array)."\n"; - - } //end of function erase_qt - - public function detect_diff_queues() - { - - // - //1. zjistime co je v zarizeni - // - - //$qt_dump = $this->conn->getall( array("queue","tree"), "", "", ".id" ); - $qt_dump = $this->conn->getall(array("queue","tree")); - - $qt_dump_trim = $qt_dump; - - //vymazeme .id, jinak nelze pole porovnat - foreach ($qt_dump_trim as $key => $value) { - - unset($qt_dump_trim["$key"][".id"]); - - } //end of foreach qt_dump_trim - - //2. zjistime, co je v adminatoru - - // - // 2.1 SmallCity Linky - // - - $sc_group = 1; - $sc_count = 0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc) * 1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc) * 1000; - - foreach ($this->objects_sc as $key => $ip) { - - if ($sc_count == 0) { //zresetovan citac sc, tj. vytvorime globalni skupinu - - //2.1.1 - agregacni SC tridy - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef) * 1000; - - $qt_system[] = array("name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit, - "priority" => "1", "max-limit" => $limit, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false"); - - $limit_sc = ($this->speed_sc_upl * $this->sc_speed_koef) * 1000; - - $qt_system[] = array("name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "limit-at" => $limit_sc, - "priority" => "1", "max-limit" => $limit_sc, "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false"); - } - - //2.1.2 - jednotlive IP adresy - - $qt_system[] = array("name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "packet-mark" => $ip."_dwn", - "limit-at" => $limit_at_sc_dwn, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_dwn) * 1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array("name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "packet-mark" => $ip."_upl", - "limit-at" => $limit_at_sc_upl, "queue" => "wireless-default", "priority" => "1", - "max-limit" => ($this->speed_sc_upl) * 1000, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - //konec cyklu - $sc_count++; - - if ($sc_count == $this->agregace_sc) { - $sc_count = 0; - $sc_group++; - } - } //end of foreach array objects_sc - - // - // 2.2 - MP linky - // - - //2.2.1 - globalni MP skupiny - $qt_system[] = array("name" => "q-dwn-mp-global", "parent" => "global-out", "limit-at" => "0", "priority" => "1", - "max-limit" => "100000000", "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array("name" => "q-upl-mp-global", "parent" => "global-out", "limit-at" => "0", "priority" => "1", - "max-limit" => "100000000", "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - - //2.2.2 - klientske linky/skupiny - - foreach ($this->objects_mp as $key => $ip) { - - $qt_system[] = array("name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "packet-mark" => $ip."_dwn", - "limit-at" => "100000", "queue" => "wireless-default", "priority" => "1", - "max-limit" => $this->speed_mp_dwn, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - - $qt_system[] = array("name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "packet-mark" => $ip."_upl", - "limit-at" => "100000", "queue" => "wireless-default", "priority" => "1", - "max-limit" => $this->speed_mp_upl, "burst-limit" => "0", "burst-threshold" => "0", - "burst-time" => "00:00:00", "invalid" => "false", "disabled" => "false"); - } - - // - // 2.3 - Garanti, routery atd - // - foreach ($this->objects_garants_used as $garant_id => $speeds) { - list($speed_dwn, $speed_upl) = explode(":", $speeds); - - //parent tridy pro garanty - $qt_system[] = array("name" => "q-dwn-".$garant_id, "parent" => "global-out", "limit-at" => $speed_dwn."000", - "priority" => "1", "max-limit" => $speed_dwn."000", "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - $qt_system[] = array("name" => "q-upl-".$garant_id, "parent" => "global-out", "limit-at" => $speed_upl."000", - "priority" => "1", "max-limit" => $speed_upl."000", "burst-limit" => "0", - "burst-threshold" => "0", "burst-time" => "00:00:00", "invalid" => "false", - "disabled" => "false" ); - - foreach ($this->{$garant_id} as $id => $ip) { - - $qt_system[] = array("name" => "q-dwn-q-".$ip, "parent" => "q-dwn-".$garant_id, "packet-mark" => $ip."_dwn", - "limit-at" => "0", "queue" => "wireless-default", "priority" => "1", "max-limit" => "0", - "burst-limit" => "0", "burst-threshold" => "0", "burst-time" => "00:00:00", - "invalid" => "false", "disabled" => "false" ); - - $qt_system[] = array("name" => "q-upl-q-".$ip, "parent" => "q-upl-".$garant_id, "packet-mark" => $ip."_upl", - "limit-at" => "0", "queue" => "wireless-default", "priority" => "1", "max-limit" => "0", - "burst-limit" => "0", "burst-threshold" => "0", "burst-time" => "00:00:00", - "invalid" => "false", "disabled" => "false"); - - } - - } - - // - // 3. porovname pole - // - - /* pole se zaznamama */ - //echo "--- printing qt_dump_trim --- \n"; print_r($qt_dump_trim); - //echo "--- printing qt_system --- \n"; print_r($qt_system); - - $this->qt_ar_exc = $this->arrayDiff($qt_dump_trim, $qt_system); - $this->qt_ar_mis = $this->arrayDiff($qt_system, $qt_dump_trim); - - echo " qt: count of classess: excess: ".count($this->qt_ar_exc).", missing: ".count($this->qt_ar_mis)." \n"; - - if ((count($this->qt_ar_exc) > 0) or (count($this->qt_ar_mis) > 0)) { - //neco nesedi .. - //echo "--- printing qt_ar_exc --- \n"; print_r($this->qt_ar_exc); - //echo "--- printing qt_ar_mis --- \n"; print_r($this->qt_ar_mis); - - //prebejvajici zaznamy smazat - - foreach ($this->qt_ar_exc as $key => $val) { - $item_id = $qt_dump[$key][".id"]; - //print " add erase number: ".$key.", item_id: ".$item_id." \n"; - - if ((strlen($item_id) > 0)) { - $qt_delete_items[] = $item_id; - } - } //end of foreach this->qt_ar_exc - - if ((is_array($qt_delete_items) and (count($qt_delete_items) > 0))) { - //print "--- qt_delete_items --- \n"; print_r($qt_delete_items); - $this->erase_qt($qt_delete_items); - } else { - echo " qt: no excess items \n"; - } - - //pridame chybejici zaznamy - if ((is_array($this->qt_ar_mis) and (count($this->qt_ar_mis) > 0))) { - //print_r($this->qt_ar_mis); - - foreach ($this->qt_ar_mis as $key => $val) { - //echo $key." => "; print_r($qt_system[$key])." \n"; - $array = $qt_system[$key]; - - unset($array["invalid"]); - $this->qt_add_single($array); - } - - print " qt: count of adding items: ".count($this->qt_ar_mis).",status: N/A \n"; - - } else { - echo " qt: no missing items \n"; - } - - //a... hotovo :-) - - } else { - //zaznamy sedi, nemam co delat - echo " qt: no excess or missing items (OK) \n"; - - } - - - } //end of function datect_diff_queues - - public function qt_add_single($input_array) - { - $qt_items_suc_added = 0; - $qt_items_err_added = 0; - - $add_qt = $this->conn->add("/queue/tree", $input_array); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt)) { - if ($this->debug > 0) { - echo " QT Item ".$add_qt." successfully added \n"; - } - $qt_items_suc_added++; - } else { - //if($this->debug > 0) - { echo " ERROR: ".print_r($add_qt)."\n"; } - $qt_items_err_added++; - } - - } //end of qt_add_single - - public function synchro_qt_force() - { - - //for testing, erasing arrays - //$this->objects_sc = array(); - //$this->objects_mp = array(); - - echo " qt - force rewriting ... \n"; - $this->qt_delete_all(); - - echo " tarif info: SmallCity: agregace: ".$this->agregace_sc.", speed dwn: ".$this->speed_sc_dwn."k, upl: ".$this->speed_sc_upl."k \n"; - - echo " qt number of records tariff: sc: ".count($this->objects_sc).", mp: ".count($this->objects_mp)."\n"; - echo " qt number of records tariff: garants: ".count($this->objects_garants_used)."\n"; - - $sc_group = 1; - $sc_count = 0; - - $limit_at_sc_dwn = ($this->speed_sc_dwn / $this->agregace_sc) * 1000; - $limit_at_sc_upl = ($this->speed_sc_upl / $this->agregace_sc) * 1000; - - $qt_ip_suc_added = 0; - $qt_ip_err_added = 0; - - //muster queues pro SC - ///queue tree - //add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1024k max-limit=1024k name=\ - // q-dwn-sc-1 parent=global-in priority=1 - - // - // QT - SMallCity - // - foreach ($this->objects_sc as $key => $ip) { - - if ($sc_count == 0) { //zresetovan citac sc, tj. vytvorime globalni skupinu - - $limit = ($this->speed_sc_dwn * $this->sc_speed_koef) * 1000; - - $qt_items_suc_added = 0; - $qt_items_err_added = 0; - - $add_qt_data = array("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-dwn-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt)) { - if ($this->debug > 0) { - echo " QT Item ".$add_qt." successfully added \n"; - } - $qt_items_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_qt)."\n"; - } - $qt_items_err_added++; - } - - $limit = ($this->speed_sc_upl * $this->sc_speed_koef) * 1000; - - $add_qt_data = array("disabled" => "false", "limit-at" => $limit, "max-limit" => $limit, - "name" => "q-upl-sc-".$sc_group, "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt)) { - if ($this->debug > 0) { - echo " QT Item ".$add_qt." successfully added \n"; - } - $qt_items_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_qt)."\n"; - } - $qt_items_err_added++; - } - - - print " add QT Group Sc No. ".$sc_group.", items ok: ".$qt_items_suc_added.", error: ".$qt_items_err_added."\n"; - - } - - // add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=1024k name=\ - // q-dwn-sc-10.2.2.2.2 packet-mark=10.52.5.14_dwn parent=q-dwn-sc-1 priority=1 queue=\ - // wireless-default - - - $add_qt_data = array("disabled" => "false", "limit-at" => $limit_at_sc_dwn, "max-limit" => (($this->speed_sc_dwn) * 1000), - "name" => "q-dwn-sc-".$ip, "parent" => "q-dwn-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt)) { - if ($this->debug > 0) { - echo " QT Item ".$add_qt." successfully added \n"; - } - $qt_ip_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_qt)."\n"; - } - $qt_ip_err_added++; - } - - $add_qt_data = array("disabled" => "false", "limit-at" => $limit_at_sc_upl, "max-limit" => (($this->speed_sc_upl) * 1000), - "name" => "q-upl-sc-".$ip, "parent" => "q-upl-sc-".$sc_group, "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - $add_qt = $this->conn->add("/queue/tree", $add_qt_data); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt)) { - if ($this->debug > 0) { - echo " QT Item ".$add_qt." successfully added \n"; - } - $qt_ip_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_qt)."\n"; - } - $qt_ip_err_added++; - } - - //konec cyklu - $sc_count++; - - if ($sc_count == $this->agregace_sc) { - $sc_count = 0; - $sc_group++; - } - } - - print " qt: count of added items: ok: ".$qt_ip_suc_added.", error: ".$qt_ip_err_added."\n"; - - // - // QT Force - MP linky - // - $qt_mp_items_suc_added = 0; - $qt_mp_items_err_added = 0; - - //globalni tridy pro MP - - $add_qt_mp_global_data = array("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-dwn-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global = $this->conn->add("/queue/tree", $add_qt_mp_global_data); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt_mp_global)) { - if ($this->debug > 0) { - echo " QT Item ".$add_qt_mp_global." successfully added \n"; - } - $qt_mp_items_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_qt_mp_global)."\n"; - } - $qt_mp_items_err_added++; - } - - $add_qt_mp_global_data2 = array("disabled" => "false", "limit-at" => "0", "max-limit" => "100000k", - "name" => "q-upl-mp-global", "parent" => "global-out", "priority" => "1", - "queue" => "wireless-default"); - - $add_qt_mp_global2 = $this->conn->add("/queue/tree", $add_qt_mp_global_data2); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt_mp_global2)) { - if ($this->debug > 0) { - echo " QT Item ".$add_qt_mp_global2." successfully added \n"; - } - $qt_mp_items_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_qt_mp_global2)."\n"; - } - $qt_mp_items_err_added++; - } - - foreach ($this->objects_mp as $key => $ip) { - - $add_qt_data_mp = array("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-dwn-mp-".$ip, "parent" => "q-dwn-mp-global", "priority" => "1", - "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_mp = $this->conn->add("/queue/tree", $add_qt_data_mp); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt_mp)) { - if ($this->debug > 0) { - echo " QT Item ".$add_qt_mp." successfully added \n"; - } - $qt_mp_items_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_qt_mp)."\n"; - } - $qt_mp_items_err_added++; - } - - $add_qt_data_mp2 = array("disabled" => "false", "limit-at" => "100k", "max-limit" => "10000k", - "name" => "q-upl-mp-".$ip, "parent" => "q-upl-mp-global", "priority" => "1", - "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_mp2 = $this->conn->add("/queue/tree", $add_qt_data_mp2); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt_mp2)) { - if ($this->debug > 0) { - echo " QT Item ".$add_qt_mp2." successfully added \n"; - } - $qt_mp_items_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_qt_mp2)."\n"; - } - $qt_mp_items_err_added++; - } - - } - - print " qt: number of records with MP: added items: ok: ".$qt_mp_items_suc_added.", error: ".$qt_mp_items_err_added."\n"; - - // - // QT Force - Garanty - // - $qt_g_items_suc_added = 0; - $qt_g_items_err_added = 0; - - foreach ($this->objects_garants_used as $garant_id => $speeds) { - list($speed_dwn, $speed_upl) = explode(":", $speeds); - - print " qt-force :: garants :: ".$garant_id.", speed_dwn: ".$speed_dwn.", speed_upl: ".$speed_upl."\n"; - - $add_qt_data_g = array("disabled" => "false", "limit-at" => $speed_dwn."k", "max-limit" => $speed_dwn."k", - "name" => "q-dwn-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g = $this->conn->add("/queue/tree", $add_qt_data_g); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt_g)) { - if ($this->debug > 0) { - echo " QT Item (garant parent dwn) ".$add_qt_g." successfully added \n"; - } - $qt_g_items_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_qt_q)."\n"; - } - $qt_g_items_err_added++; - } - - $add_qt_data_g2 = array("disabled" => "false", "limit-at" => $speed_upl."k", "max-limit" => $speed_upl."k", - "name" => "q-upl-".$garant_id, "parent" => "global-out", "priority" => "1", "queue" => "wireless-default"); - - $add_qt_g2 = $this->conn->add("/queue/tree", $add_qt_data_g2); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt_g2)) { - if ($this->debug > 0) { - echo " QT Item (garant parent upl) ".$add_qt_g2." successfully added \n"; - } - $qt_g_items_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_qt_q2)."\n"; - } - $qt_g_items_err_added++; - } - - foreach ($this->{$garant_id} as $id => $ip) { - - $add_qt_data_g_dwn = array("disabled" => "false", "name" => "q-dwn-q-".$ip, "parent" => "q-dwn-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_dwn", "queue" => "wireless-default"); - - $add_qt_g_dwn = $this->conn->add("/queue/tree", $add_qt_data_g_dwn); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt_g_dwn)) { - if ($this->debug > 0) { - echo " QT Item (garant ".$ip." dwn) ".$add_qt_g_dwn." successfully added \n"; - } - $qt_g_items_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_qt_q_dwn)."\n"; - } - $qt_g_items_err_added++; - } - - $add_qt_data_g_upl = array("disabled" => "false", "name" => "q-upl-q-".$ip, "parent" => "q-upl-".$garant_id, - "priority" => "1", "packet-mark" => $ip."_upl", "queue" => "wireless-default"); - - $add_qt_g_upl = $this->conn->add("/queue/tree", $add_qt_data_g_upl); - - if (ereg('^\*([[:xdigit:]])*$', $add_qt_g_upl)) { - if ($this->debug > 0) { - echo " QT Item (garant ".$ip." upl) ".$add_qt_g_upl." successfully added \n"; - } - $qt_g_items_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_qt_q2)."\n"; - } - $qt_g_items_err_added++; - } - - - } //end of FOREACH $this->{$garant_id} - - } //end of FOREACH objects_garants_used - - print " qt: number of records with GARANT: added items: ok: ".$qt_g_items_suc_added.", error: ".$qt_g_items_err_added."\n"; - - } //end of function synchro_qt_force - - -} //end of class mk_synchro_qos diff --git a/adminator3/app/Core/shared/ros_api_restriction.php b/adminator3/app/Core/shared/ros_api_restriction.php deleted file mode 100644 index 2bc474e1b..000000000 --- a/adminator3/app/Core/shared/ros_api_restriction.php +++ /dev/null @@ -1,344 +0,0 @@ -conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$id_routeru'"); - - while ($d = $rs->fetch_array()) { - $parent_router = $d["parent_router"]; - } - - $rs2 = $this->conn_mysql->query("SELECT parent_router, ip_adresa FROM router_list WHERE id = '$parent_router'"); - - while ($d2 = $rs2->fetch_array()) { - $ip_adresa_2 = $d2["ip_adresa"]; - } - - if ($ip_adresa_2 == $ip_adresa_routeru) { //dosahlo se reinhard-fiber, tj. zaznam CHCEME - return true; - } elseif ($parent_router == "0") { //dosahlo se reinhard-wifi, takze zaznam nechceme - } else { //ani jedno predchozi, rekurze .. :) - if ($this->find_root_router($parent_router, $ip_adresa_routeru) == true) { - return true; - } - } - - } //end of function find_root_router - - public function find_obj($ip) - { - $routers = array(); - - //1. zjistit routery co jedou pres reinhard-fiber - $rs_routers = $this->conn_mysql->query("SELECT id, parent_router, nazev FROM router_list ORDER BY id"); - $num_rs_routers = $rs_routers->num_rows; - - if ($num_rs_routers < 1) { - echo "mk_net_n_sikana\\find_obj: query failed: no router found!
\n"; - return false; - } - - while ($data_routers = $rs_routers->fetch_array()) { - $id_routeru = $data_routers["id"]; - if ($this->find_root_router($id_routeru, $ip) === true) { - $routers[] = $id_routeru; - } - } - - if (count($routers) < 1) { - echo "ros_api_restriction\\find_obj: Error: no downstream/connected router(s) found!
\n"; - return false; - } else { - echo "ros_api_restriction\\find_obj: INFO: found " . count($routers) . " router(s)
\n"; - } - - //2. zjistit nody - $i = 0; - foreach ($routers as $key => $id_routeru) { - - //print "router: ".$id_routeru.", \t\t selected \n"; - if ($i == 0) { - $sql_where .= "'$id_routeru'"; - } else { - $sql_where .= ",'$id_routeru'"; - } - - $i++; - } - - $sql = "SELECT id, jmeno FROM nod_list WHERE router_id IN (".$sql_where.") ORDER BY id"; - //print $sql."\n"; - - $rs_nods = $this->conn_mysql->query($sql); - if ($rs_nods === false) { - echo "mk_net_n_sikana\\find_obj: Error: nod_list query failed!
\n"; - printf("Error message: %s
\n", $this->conn_mysql->error); - return false; - } - - $num_rs_nods = $rs_nods->num_rows; - if ($rs_nods < 1) { - echo "mk_net_n_sikana\\find_obj: Error: No nodes found! (for routers: " . $sql_where. ")
\n"; - return false; - } else { - echo "mk_net_n_sikana\\find_obj: Info: Found " . $num_rs_nods . " nodes(s)! (for routers: " . $sql_where. ")
\n"; - } - - while ($data_nods = $rs_nods->fetch_array()) { - $nods[] = $data_nods["id"]; - } - - //3. zjistit lidi - $i = 0; - - foreach ($nods as $key => $id_nodu) { - //print "nods: ".$id_nodu." \n"; - - if ($i == 0) { - $sql_obj_where .= "'$id_nodu'"; - } else { - $sql_obj_where .= ",'$id_nodu'"; - } - - $i++; - } - - $sql_obj = "SELECT ip, dov_net, sikana_status - FROM objekty - WHERE ( - id_nodu IN (".$sql_obj_where.") - AND - ( - objekty.dov_net = 'n'::bpchar - OR - objekty.sikana_status ~~ '%a%'::text - ) - ) - ORDER BY id_komplu"; - //print $sql_obj."\n"; - - $this->rs_objects = pg_query($sql_obj); - if ($this->rs_objects === false) { - echo "mk_net_n_sikana\\find_obj: Error: Pg_query failed!
\n"; - echo pg_last_error() . "
\n"; - return false; - } - - $num_rs_objects = pg_num_rows($this->rs_objects); - - while ($data = pg_fetch_array($this->rs_objects)) { - - if ($data["dov_net"] == "n") { - $this->objects_net_n[] = $data["ip"]; - } elseif ($data["sikana_status"] == "a") { - $this->objects_sikana[] = $data["ip"]; - } else { - echo " ERROR: wrong item selected (IP: ".$data["ip"].") \n"; - } - } - - print " number of restricted IP addresses: ".$num_rs_objects; - if ($this->debug == 1) { - echo ", array objects counts: ".count($this->objects_net_n)." ".count($this->objects_sikana); - } - - echo "\n"; - - } //end of function - - public function remove_wrong_items($wrong_items) - { - $item_del_ok = 0; - $item_del_err = 0; - - //print_r($wrong_items); - - $del = $this->conn->remove("/ip/firewall/address-list", $wrong_items); - - if ($del == "1") { - if ($this->debug > 0) { - echo " Wrong Item(s) successfully deleted (".count($wrong_items).")\n"; - } - $item_del_ok = count($wrong_items); - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($del)."\n"; - } - $item_del_err++; - } - - print " Deleted wrong items: ".$item_del_ok.", error(s): ".$item_del_err."\n"; - - } //end of function remove_wrong_items - - public function detect_diff_and_repaid($mod) - { - if (!(($mod == "sikana") or ($mod == "net-n"))) { - echo "ERROR: wrong mode in function \"detect_diff\" \n"; - exit; - } - - $this->wrong_items = array(); - $this->device_items = array(); - - $this->arr_diff_exc = array(); - $this->arr_diff_mis = array(); - - if ($mod == "net-n") { - $system_items = $this->objects_net_n; - } else { - $system_items = $this->objects_sikana; - } - - $query = (new Query('/ip/firewall/address-list/print')); - $responseFwAddrList = $this->rosClient->query($query)->read(); - - echo "
" . var_export($responseFwAddrList, true) ."
\n"; - - foreach ($responseFwAddrList as $key => $value) { - - if ($this->getall["$key"]["list"] == "$mod") { - $id = $this->getall["$key"][".id"]; - - if ($this->getall["$key"]["disabled"] == "true") { - $this->wrong_items[] = $id; - } else { - $this->device_items[$id] = $this->getall["$key"]["address"]; - } - - //print_r($this->getall["$key"]); - } - - } //end of foreach getall - - echo " $mod: number of records : device: ".count($this->device_items).", system: ".count($system_items)."\n"; - - - $this->arr_diff_exc = array_diff($this->device_items, $system_items); - $this->arr_diff_mis = array_diff($system_items, $this->device_items); - - //print_r($this->arr_diff_exc); - //print_r($system_items); - - if (((count($this->arr_diff_exc) == 0) and (count($this->arr_diff_mis) == 0) and (count($this->wrong_items) == 0))) { - echo " $mod: records OK
\n"; - } else { - foreach ($this->arr_diff_exc as $key => $value) { - $this->wrong_items[] = $key; - } - - echo " $mod: number of records : excess: ".count($this->wrong_items).", missing: ".count($this->arr_diff_mis)."\n"; - - //print_r($this->wrong_items); - if ((count($this->wrong_items) > 0)) { - $this->remove_wrong_items($this->wrong_items); - } - - if ((count($this->arr_diff_mis) > 0)) { - $this->add_items($mod); - } - } - - - } //end of function detect_diff_records - - public function add_items($mod) - { - if (!(($mod == "sikana") or ($mod == "net-n"))) { - echo "ERROR: wrong mode in function \"add_items\" \n"; - exit; - } - - $item_err_added = 0; - $item_suc_added = 0; - - foreach ($this->arr_diff_mis as $key => $ip) { - - $add_data = array("address" => $ip, "list" => $mod); - $add_item = $this->conn->add("/ip/firewall/address-list", $add_data); - - if (ereg('^\*([[:xdigit:]])*$', $add_item)) { - if ($this->debug > 0) { - echo " Item ".$add_item." successfully added \n"; - } - $item_suc_added++; - } else { - if ($this->debug > 0) { - echo " ERROR: ".print_r($add_item)."\n"; - } - $item_err_added++; - } - - - } //end of foreach - - echo " $mod add items ok: ".$item_suc_added.", error: ".$item_err_added."\n"; - - - } //end of function add_items - - public function zamek_lock() - { - $rs = $this->conn_mysql->query("UPDATE workzamek SET zamek = 'ano' WHERE id = 1"); - } - - public function zamek_unlock() - { - $rs = $this->conn_mysql->query("UPDATE workzamek SET zamek = 'ne' WHERE id = 1"); - } - - public function zamek_status() - { - $rs = $this->conn_mysql->query("SELECT zamek FROM workzamek WHERE id = 1"); - - while ($data = $rs->fetch_array()) { - $zamek_status = $data["zamek"]; - } - - if ($zamek_status == "ano") { - print " Nelze provést AKCI, jiz se nejaka provadi (LOCKED). Ukončuji skript. \n"; - exit; - } - - } //end of function zamek_status - -} //end of class mk_synchro_qos From 6713aed45620db5b49d2e835646613a30fe95366 Mon Sep 17 00:00:00 2001 From: Patrik Majer Date: Sun, 29 Jun 2025 08:50:40 +0200 Subject: [PATCH 3/4] fix compose --- adminator3/composer.json | 1 + adminator3/composer.lock | 286 +++++++++++++++++++++++++++++---------- 2 files changed, 219 insertions(+), 68 deletions(-) diff --git a/adminator3/composer.json b/adminator3/composer.json index 8d8213c37..fcaa0572b 100644 --- a/adminator3/composer.json +++ b/adminator3/composer.json @@ -38,6 +38,7 @@ "setasign/fpdf": "1.8.6", "phpmailer/phpmailer": "^6.9.1", "lloricode/laravel-html-table": "^2.1", + "evilfreelancer/routeros-api-php": "1.5.2", "robmorgan/phinx": "^0.12.10", "open-telemetry/opentelemetry-auto-slim": "1.1.1", "open-telemetry/exporter-otlp": "1.3.1", diff --git a/adminator3/composer.lock b/adminator3/composer.lock index bad632608..13f25a687 100644 --- a/adminator3/composer.lock +++ b/adminator3/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a99b79586617bfecbc1a60c1cdfb7b8f", + "content-hash": "68f14e17f059ca4bbb6171f9e75580f7", "packages": [ { "name": "amnuts/opcache-gui", @@ -1107,6 +1107,97 @@ ], "time": "2025-03-06T22:45:56+00:00" }, + { + "name": "evilfreelancer/routeros-api-php", + "version": "1.5.2", + "source": { + "type": "git", + "url": "https://github.com/EvilFreelancer/routeros-api-php.git", + "reference": "f247a4cfa6126a8d0302dbbc4a7a7520cbb0d8a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/EvilFreelancer/routeros-api-php/zipball/f247a4cfa6126a8d0302dbbc4a7a7520cbb0d8a3", + "reference": "f247a4cfa6126a8d0302dbbc4a7a7520cbb0d8a3", + "shasum": "" + }, + "require": { + "ext-sockets": "*", + "php": "^7.4|^8.0", + "spatie/ssh": "^1.8" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16", + "larapack/dd": "^1.1", + "limedeck/phpunit-detailed-printer": "^5.0", + "orchestra/testbench": "^4.0|^5.0", + "phpunit/phpunit": "^8.0", + "rector/rector": "^0.7|^0.8|^0.9", + "roave/security-advisories": "dev-master", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "RouterOS": "RouterOS\\Laravel\\Facade" + }, + "providers": [ + "RouterOS\\Laravel\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "RouterOS\\": "./src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paul Rock", + "email": "paul@drteam.rocks", + "homepage": "http://drteam.rocks/", + "role": "Developer" + } + ], + "description": "Modern Mikrotik RouterOS API PHP client for your applications (with Laravel support)", + "keywords": [ + "PSR-4", + "facade", + "laravel", + "mikrotik", + "plugin", + "routeros", + "socket-client" + ], + "support": { + "issues": "https://github.com/EvilFreelancer/routeros-api-php/issues", + "source": "https://github.com/EvilFreelancer/routeros-api-php/tree/1.5.2" + }, + "funding": [ + { + "url": "https://streamlabs.com/evilfreelancer/tip", + "type": "custom" + }, + { + "url": "https://www.donationalerts.com/r/evilfreelancer", + "type": "custom" + }, + { + "url": "https://ko-fi.com/efreelancer", + "type": "ko_fi" + }, + { + "url": "https://www.patreon.com/efreelancer", + "type": "patreon" + } + ], + "time": "2023-12-03T10:28:22+00:00" + }, { "name": "fig/http-message-util", "version": "1.1.5", @@ -6765,6 +6856,65 @@ ], "time": "2025-04-11T15:27:14+00:00" }, + { + "name": "spatie/ssh", + "version": "1.13.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/ssh.git", + "reference": "cfccf0873611a2d1b030f65d1dd319c8005d993f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/ssh/zipball/cfccf0873611a2d1b030f65d1dd319c8005d993f", + "reference": "cfccf0873611a2d1b030f65d1dd319c8005d993f", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0", + "symfony/process": "^4.4|^5.3|^6.0|^7.0" + }, + "require-dev": { + "pestphp/pest": "^1.22", + "spatie/pest-plugin-snapshots": "^1.1", + "symfony/var-dumper": "^5.3|6.0|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\Ssh\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "A lightweight package to execute commands over an SSH connection", + "homepage": "https://github.com/spatie/ssh", + "keywords": [ + "spatie", + "ssh" + ], + "support": { + "issues": "https://github.com/spatie/ssh/issues", + "source": "https://github.com/spatie/ssh/tree/1.13.0" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + } + ], + "time": "2024-12-23T10:27:18+00:00" + }, { "name": "symfony/config", "version": "v6.4.22", @@ -6842,16 +6992,16 @@ }, { "name": "symfony/console", - "version": "v6.4.22", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "7d29659bc3c9d8e9a34e2c3414ef9e9e003e6cf3" + "reference": "9056771b8eca08d026cd3280deeec3cfd99c4d93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/7d29659bc3c9d8e9a34e2c3414ef9e9e003e6cf3", - "reference": "7d29659bc3c9d8e9a34e2c3414ef9e9e003e6cf3", + "url": "https://api.github.com/repos/symfony/console/zipball/9056771b8eca08d026cd3280deeec3cfd99c4d93", + "reference": "9056771b8eca08d026cd3280deeec3cfd99c4d93", "shasum": "" }, "require": { @@ -6916,7 +7066,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.22" + "source": "https://github.com/symfony/console/tree/v6.4.23" }, "funding": [ { @@ -6932,7 +7082,7 @@ "type": "tidelift" } ], - "time": "2025-05-07T07:05:04+00:00" + "time": "2025-06-27T19:37:22+00:00" }, { "name": "symfony/css-selector", @@ -7068,16 +7218,16 @@ }, { "name": "symfony/error-handler", - "version": "v6.4.22", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "ce765a2d28b3cce61de1fb916e207767a73171d1" + "reference": "b088e0b175c30b4e06d8085200fa465b586f44fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/ce765a2d28b3cce61de1fb916e207767a73171d1", - "reference": "ce765a2d28b3cce61de1fb916e207767a73171d1", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/b088e0b175c30b4e06d8085200fa465b586f44fa", + "reference": "b088e0b175c30b4e06d8085200fa465b586f44fa", "shasum": "" }, "require": { @@ -7123,7 +7273,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.4.22" + "source": "https://github.com/symfony/error-handler/tree/v6.4.23" }, "funding": [ { @@ -7139,7 +7289,7 @@ "type": "tidelift" } ], - "time": "2025-05-28T12:00:15+00:00" + "time": "2025-06-13T07:39:48+00:00" }, { "name": "symfony/event-dispatcher", @@ -7429,16 +7579,16 @@ }, { "name": "symfony/http-foundation", - "version": "v6.4.22", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "6b7c97fe1ddac8df3cc9ba6410c8abc683e148ae" + "reference": "452d19f945ee41345fd8a50c18b60783546b7bd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/6b7c97fe1ddac8df3cc9ba6410c8abc683e148ae", - "reference": "6b7c97fe1ddac8df3cc9ba6410c8abc683e148ae", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/452d19f945ee41345fd8a50c18b60783546b7bd3", + "reference": "452d19f945ee41345fd8a50c18b60783546b7bd3", "shasum": "" }, "require": { @@ -7486,7 +7636,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.4.22" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.23" }, "funding": [ { @@ -7502,20 +7652,20 @@ "type": "tidelift" } ], - "time": "2025-05-11T15:36:20+00:00" + "time": "2025-05-26T09:17:58+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.4.22", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "15c105b839a7cfa1bc0989c091bfb6477f23b673" + "reference": "2bb2cba685aabd859f22cf6946554e8e7f3c329a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/15c105b839a7cfa1bc0989c091bfb6477f23b673", - "reference": "15c105b839a7cfa1bc0989c091bfb6477f23b673", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/2bb2cba685aabd859f22cf6946554e8e7f3c329a", + "reference": "2bb2cba685aabd859f22cf6946554e8e7f3c329a", "shasum": "" }, "require": { @@ -7600,7 +7750,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.22" + "source": "https://github.com/symfony/http-kernel/tree/v6.4.23" }, "funding": [ { @@ -7616,20 +7766,20 @@ "type": "tidelift" } ], - "time": "2025-05-29T07:23:40+00:00" + "time": "2025-06-28T08:14:51+00:00" }, { "name": "symfony/mailer", - "version": "v6.4.21", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "ada2809ccd4ec27aba9fc344e3efdaec624c6438" + "reference": "a480322ddf8e54de262c9bca31fdcbe26b553de5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/ada2809ccd4ec27aba9fc344e3efdaec624c6438", - "reference": "ada2809ccd4ec27aba9fc344e3efdaec624c6438", + "url": "https://api.github.com/repos/symfony/mailer/zipball/a480322ddf8e54de262c9bca31fdcbe26b553de5", + "reference": "a480322ddf8e54de262c9bca31fdcbe26b553de5", "shasum": "" }, "require": { @@ -7680,7 +7830,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.4.21" + "source": "https://github.com/symfony/mailer/tree/v6.4.23" }, "funding": [ { @@ -7696,7 +7846,7 @@ "type": "tidelift" } ], - "time": "2025-04-26T23:47:35+00:00" + "time": "2025-06-26T21:24:02+00:00" }, { "name": "symfony/mime", @@ -8971,16 +9121,16 @@ }, { "name": "symfony/translation", - "version": "v6.4.22", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "7e3b3b7146c6fab36ddff304a8041174bf6e17ad" + "reference": "de8afa521e04a5220e9e58a1dc99971ab7cac643" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/7e3b3b7146c6fab36ddff304a8041174bf6e17ad", - "reference": "7e3b3b7146c6fab36ddff304a8041174bf6e17ad", + "url": "https://api.github.com/repos/symfony/translation/zipball/de8afa521e04a5220e9e58a1dc99971ab7cac643", + "reference": "de8afa521e04a5220e9e58a1dc99971ab7cac643", "shasum": "" }, "require": { @@ -9046,7 +9196,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.4.22" + "source": "https://github.com/symfony/translation/tree/v6.4.23" }, "funding": [ { @@ -9062,7 +9212,7 @@ "type": "tidelift" } ], - "time": "2025-05-29T07:06:44+00:00" + "time": "2025-06-26T21:24:02+00:00" }, { "name": "symfony/translation-contracts", @@ -9144,16 +9294,16 @@ }, { "name": "symfony/uid", - "version": "v6.4.13", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/uid.git", - "reference": "18eb207f0436a993fffbdd811b5b8fa35fa5e007" + "reference": "9c8592da78d7ee6af52011eef593350d87e814c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/uid/zipball/18eb207f0436a993fffbdd811b5b8fa35fa5e007", - "reference": "18eb207f0436a993fffbdd811b5b8fa35fa5e007", + "url": "https://api.github.com/repos/symfony/uid/zipball/9c8592da78d7ee6af52011eef593350d87e814c0", + "reference": "9c8592da78d7ee6af52011eef593350d87e814c0", "shasum": "" }, "require": { @@ -9198,7 +9348,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/uid/tree/v6.4.13" + "source": "https://github.com/symfony/uid/tree/v6.4.23" }, "funding": [ { @@ -9214,20 +9364,20 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:18:03+00:00" + "time": "2025-06-26T08:06:12+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.4.21", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "22560f80c0c5cd58cc0bcaf73455ffd81eb380d5" + "reference": "d55b1834cdbfcc31bc2cd7e095ba5ed9a88f6600" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/22560f80c0c5cd58cc0bcaf73455ffd81eb380d5", - "reference": "22560f80c0c5cd58cc0bcaf73455ffd81eb380d5", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/d55b1834cdbfcc31bc2cd7e095ba5ed9a88f6600", + "reference": "d55b1834cdbfcc31bc2cd7e095ba5ed9a88f6600", "shasum": "" }, "require": { @@ -9283,7 +9433,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.21" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.23" }, "funding": [ { @@ -9299,20 +9449,20 @@ "type": "tidelift" } ], - "time": "2025-04-09T07:34:50+00:00" + "time": "2025-06-27T15:05:27+00:00" }, { "name": "tbachert/spi", - "version": "v1.0.3", + "version": "v1.0.4", "source": { "type": "git", "url": "https://github.com/Nevay/spi.git", - "reference": "506a79c98e1a51522e76ee921ccb6c62d52faf3a" + "reference": "86e355edfdd57f9cb720bd2ac3af7dde521ca0e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Nevay/spi/zipball/506a79c98e1a51522e76ee921ccb6c62d52faf3a", - "reference": "506a79c98e1a51522e76ee921ccb6c62d52faf3a", + "url": "https://api.github.com/repos/Nevay/spi/zipball/86e355edfdd57f9cb720bd2ac3af7dde521ca0e7", + "reference": "86e355edfdd57f9cb720bd2ac3af7dde521ca0e7", "shasum": "" }, "require": { @@ -9330,7 +9480,7 @@ "extra": { "class": "Nevay\\SPI\\Composer\\Plugin", "branch-alias": { - "dev-main": "0.2.x-dev" + "dev-main": "1.0.x-dev" }, "plugin-optional": true }, @@ -9349,9 +9499,9 @@ ], "support": { "issues": "https://github.com/Nevay/spi/issues", - "source": "https://github.com/Nevay/spi/tree/v1.0.3" + "source": "https://github.com/Nevay/spi/tree/v1.0.4" }, - "time": "2025-04-02T19:38:14+00:00" + "time": "2025-06-28T20:18:22+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -13608,16 +13758,16 @@ }, { "name": "symfony/dom-crawler", - "version": "v7.3.0", + "version": "v7.3.1", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "0fabbc3d6a9c473b716a93fc8e7a537adb396166" + "reference": "8b2ee2e06ab99fa5f067b6699296d4e35c156bb9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/0fabbc3d6a9c473b716a93fc8e7a537adb396166", - "reference": "0fabbc3d6a9c473b716a93fc8e7a537adb396166", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/8b2ee2e06ab99fa5f067b6699296d4e35c156bb9", + "reference": "8b2ee2e06ab99fa5f067b6699296d4e35c156bb9", "shasum": "" }, "require": { @@ -13655,7 +13805,7 @@ "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v7.3.0" + "source": "https://github.com/symfony/dom-crawler/tree/v7.3.1" }, "funding": [ { @@ -13671,7 +13821,7 @@ "type": "tidelift" } ], - "time": "2025-03-05T10:15:41+00:00" + "time": "2025-06-15T10:07:06+00:00" }, { "name": "symfony/options-resolver", @@ -13804,16 +13954,16 @@ }, { "name": "symfony/yaml", - "version": "v6.4.21", + "version": "v6.4.23", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "f01987f45676778b474468aa266fe2eda1f2bc7e" + "reference": "93e29e0deb5f1b2e360adfb389a20d25eb81a27b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/f01987f45676778b474468aa266fe2eda1f2bc7e", - "reference": "f01987f45676778b474468aa266fe2eda1f2bc7e", + "url": "https://api.github.com/repos/symfony/yaml/zipball/93e29e0deb5f1b2e360adfb389a20d25eb81a27b", + "reference": "93e29e0deb5f1b2e360adfb389a20d25eb81a27b", "shasum": "" }, "require": { @@ -13856,7 +14006,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.21" + "source": "https://github.com/symfony/yaml/tree/v6.4.23" }, "funding": [ { @@ -13872,7 +14022,7 @@ "type": "tidelift" } ], - "time": "2025-04-04T09:48:44+00:00" + "time": "2025-06-03T06:46:12+00:00" }, { "name": "symplify/coding-standard", From 273c665ae6b73e244e9bd5580a5e2f409d0ae4fd Mon Sep 17 00:00:00 2001 From: Patrik Majer Date: Sun, 29 Jun 2025 08:55:23 +0200 Subject: [PATCH 4/4] fix format --- adminator2/platby-hot-vypis.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adminator2/platby-hot-vypis.php b/adminator2/platby-hot-vypis.php index 50c2ee7c8..fa7cb3ddf 100644 --- a/adminator2/platby-hot-vypis.php +++ b/adminator2/platby-hot-vypis.php @@ -5,7 +5,7 @@ require("include/check_login.php"); require("include/check_level.php"); -if(!(check_level($level, 44))) { +if (!(check_level($level, 44))) { // neni level $stranka = 'nolevelpage.php'; header("Location: ".$stranka); @@ -82,11 +82,11 @@ echo "
Database Error: ". $e->getMessage() . "
"; } -if(!$vyber) { +if (!$vyber) { echo "
Chyba! Data nelze načíst!
"; echo "
Error: No database handler.
"; echo "
" . pg_last_error() . "
"; -} elseif(pg_num_rows($vyber) < 1) { +} elseif (pg_num_rows($vyber) < 1) { echo "
zadne platby
"; } else { // $listovani->listInterval(); //zobrazení stránkovače