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
This commit is contained in:
malle-pietje 2020-01-31 12:14:52 +01:00
parent ca25c8ab52
commit a3fc0732e2
2 changed files with 8 additions and 3 deletions

View File

@ -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) - 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 - 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. You can use [Composer](#composer), [Git](#git) or simply [Download the Release](#download-the-release) to install the API client class.

View File

@ -43,7 +43,8 @@ function update_ports($running_config, $ports, $poe_mode){
/** /**
* Update already non-default ports * 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)){ if(in_array($running_config[$i]->port_idx, $ports)){
$running_config[$i]->poe_mode = $poe_mode; $running_config[$i]->poe_mode = $poe_mode;
unset($ports[array_search($running_config[$i]->port_idx, $ports)]); 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" * 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]; $poe_mode = $_GET[poe_mode];
} elseif (isset($argv[1])) { } elseif (isset($argv[1])) {
$poe_mode = $argv[1]; $poe_mode = $argv[1];