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:
parent
231b4c3326
commit
290cad8107
@ -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();
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user