Use Curl for network connectivity checks

This commit is contained in:
ljm42
2024-03-24 14:54:38 -07:00
parent 0b7f980e97
commit 537149f206
4 changed files with 16 additions and 3 deletions

View File

@@ -11,6 +11,9 @@
*/
?>
<?
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Wrappers.php";
// Invoke the plugin command with indicated method
function plugin($method, $arg = '') {
global $docroot;
@@ -27,7 +30,7 @@ function language($method, $arg = '') {
function check_plugin($arg, &$ncsi) {
// Get network connection status indicator (NCSI)
if ($ncsi===null) $ncsi = exec("wget --spider --no-check-certificate -nv -T10 -t1 https://www.msftncsi.com/ncsi.txt 2>&1|grep -o 'OK'");
if ($ncsi===null) $ncsi = check_network_connectivity();
return $ncsi ? plugin('check',$arg) : false;
}

View File

@@ -44,7 +44,7 @@ function write(...$messages){
}
write(_("Checking connectivity")." ...\n");
if (exec("wget --spider --no-check-certificate -nv -T10 -t1 https://www.msftncsi.com/ncsi.txt 2>&1|grep -om1 'OK'")) {
if (check_network_connectivity()) {
$check = popen('plugin checkall','r');
while (!feof($check)) write(fgets($check));
pclose($check);