From a3fc0732e281dc3ebcb6d403ea2cdce19ffb9989 Mon Sep 17 00:00:00 2001 From: malle-pietje Date: Fri, 31 Jan 2020 12:14:52 +0100 Subject: [PATCH] API client class v1.1.46 - applied patches to update_switch_poe-mode.php as suggested by scrutinizer-ci.com - placed warning that UniFI OS is not (yet) supported --- README.md | 6 +++++- examples/update_switch_poe-mode.php | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2d973d9..c0693e3 100755 --- a/README.md +++ b/README.md @@ -9,7 +9,11 @@ This class can be installed manually or using composer/[packagist](https://packa - a web server with PHP and cURL modules installed (tested on Apache 2.4 with PHP Version 5.6.1 and cURL 7.42.1 and with PHP 7.2.24 and cURL 7.58.0) - network connectivity between this web server and the server and port (normally TCP port 8443) where the UniFi Controller is running -## Installation ## +## UniFi OS Support + +Currently, UniFi OS-based controllers (UniFi Dream Machine Pro) are **not supported** due to several breaking changes to the API. + +## Installation You can use [Composer](#composer), [Git](#git) or simply [Download the Release](#download-the-release) to install the API client class. diff --git a/examples/update_switch_poe-mode.php b/examples/update_switch_poe-mode.php index 3b7869a..01a2438 100755 --- a/examples/update_switch_poe-mode.php +++ b/examples/update_switch_poe-mode.php @@ -43,7 +43,8 @@ function update_ports($running_config, $ports, $poe_mode){ /** * Update already non-default ports */ - for($i = 0; $i < count($running_config); $i++){ + $running_config_count = count($running_config); + for($i = 0; $i < $running_config_count; $i++){ if(in_array($running_config[$i]->port_idx, $ports)){ $running_config[$i]->poe_mode = $poe_mode; unset($ports[array_search($running_config[$i]->port_idx, $ports)]); @@ -71,7 +72,7 @@ $current_conf = $data[0]->port_overrides; /** * This reads in the values provided via URL or in the command line, if nothing is set than it will poe_mode will be set to "auto" */ -if (isset($_GET[poe_mode])) { +if (isset($_GET[$poe_mode])) { $poe_mode = $_GET[poe_mode]; } elseif (isset($argv[1])) { $poe_mode = $argv[1];