1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2025-07-09 19:27:40 +02:00

Update getWirelessClients() w/ interface parameter

This commit is contained in:
billz 2025-05-24 10:15:58 -07:00
parent 231b4c3326
commit 290cad8107
2 changed files with 5 additions and 3 deletions

View File

@ -32,7 +32,7 @@ function DisplayDashboard(&$extraFooterScripts): void
$connectionType = $dashboard->getConnectionType(); $connectionType = $dashboard->getConnectionType();
$connectionIcon = $dashboard->getConnectionIcon($connectionType); $connectionIcon = $dashboard->getConnectionIcon($connectionType);
$state = strtolower($details['state']); $state = strtolower($details['state']);
$wirelessClients = $dashboard->getWirelessClients(); $wirelessClients = $dashboard->getWirelessClients($interface);
$ethernetClients = $dashboard->getEthernetClients(); $ethernetClients = $dashboard->getEthernetClients();
$totalClients = $wirelessClients + $ethernetClients; $totalClients = $wirelessClients + $ethernetClients;
$plugins = $pluginManager->getInstalledPlugins(); $plugins = $pluginManager->getInstalledPlugins();

View File

@ -162,11 +162,13 @@ class Dashboard {
/* /*
* Parses the output of iw to obtain a list of wireless clients * Parses the output of iw to obtain a list of wireless clients
* *
* @param string $interface
* @return integer $clientCount * @return integer $clientCount
*/ */
public function getWirelessClients() public function getWirelessClients($interface): int
{ {
exec('iw dev wlan0 station dump', $output, $status); $cmd = 'iw dev '. escapeshellarg($interface) .' station dump';
exec($cmd, $output, $status);
if ($status !== 0) { if ($status !== 0) {
return 0; return 0;