1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2025-07-28 19:59:24 +02:00

Merge pull request #1867 from RaspAP/fix/dashboard-wlan

Update getWirelessClients() w/ interface parameter
This commit is contained in:
Bill Zimmerman 2025-05-25 08:39:20 +02:00 committed by GitHub
commit 98f11477b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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;