diff --git a/examples/toggle_auto_update_settings.php b/examples/toggle_auto_update_settings.php new file mode 100755 index 0000000..a3b1cf0 --- /dev/null +++ b/examples/toggle_auto_update_settings.php @@ -0,0 +1,69 @@ +login(); + +if ($login_results) { + /** + * we get the current site mgmt settings + */ + $current_site_settings = $unifi_connection->list_settings(); + + $mgmt_settings = []; + foreach ($current_site_settings as $section) { + if ($section->key == 'mgmt') { + $mgmt_settings = $section; + } + } + + /** + * toggle the auto upgrade setting and set the auto upgrade hour to 3 + */ + $mgmt_settings->auto_upgrade = !$mgmt_settings->auto_upgrade; + $mgmt_settings->auto_upgrade_hour = 3; + $mgmt_id = $mgmt_settings->_id; + $set_result = $unifi_connection->set_site_mgmt($mgmt_id, $mgmt_settings); + + echo 'done' . PHP_EOL; + exit(); +} + +echo 'login failed' . PHP_EOL; \ No newline at end of file