Skip to content

Commit

Permalink
Add relevant info for DHCP device names
Browse files Browse the repository at this point in the history
  • Loading branch information
martignoni committed Mar 24, 2024
1 parent cd40635 commit 0c5ea2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion classes/local/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,11 @@ public static function get_connected_ip_adresses($interface, $leasesfile) {
// Find MAC and IP addresses in lease file, and get matching device name.
if ($m = preg_grep('/^.*' . $macaddress . '\s' . $arpmacippairs[$macaddress] . '.*$/i', $leases)) {
$name = explode(' ', reset($m))[3];
if ( $name == '*') {
$name = get_string('hiddendhcpname', 'tool_moodlebox');
}
} else {
$name = '*';
$name = get_string('unknowndhcpname', 'tool_moodlebox');
}
$connecteddata[$macaddress] = [
'ip' => $arpmacippairs[$macaddress],
Expand Down
6 changes: 4 additions & 2 deletions lang/en/tool_moodlebox.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
$string['datetimesetmessage'] = 'The clock of the MoodleBox isn\'t on time. It\'s highly recommended to set the date and time to the current time.';
$string['datetimesetting'] = 'Date and time';
$string['defaultgateway'] = 'Default gateway';
$string['dhcpclientinfo'] = 'Client IP and MAC addresses';
$string['dhcpclientinfo'] = 'Client IP address, name and MAC address';
$string['dhcpclientnumber'] = 'number of clients';
$string['dhcpclients'] = 'DHCP clients';
$string['documentation'] = 'MoodleBox documentation';
Expand All @@ -50,6 +50,7 @@
$string['forum_desc'] = '<p>If you can\'t find an answer to your question in the <a href="https://moodlebox.net/en/help/" title="MoodleBox documentation" target="_blank">MoodleBox documentation</a>, search the <a href="https://discuss.moodlebox.net/" title="MoodleBox forum" target="_blank">MoodleBox support forum</a> to see if your question has already been answered. Otherwise, feel free to open a new discussion.</p>';
$string['hardwareinfo'] = 'Hardware information';
$string['hidden'] = 'Hidden';
$string['hiddendhcpname'] = '<HIDDEN>';
$string['infofileerror'] = 'Information not available';
$string['infoheading'] = 'MoodleBox support information';
$string['information'] = 'Information';
Expand All @@ -64,7 +65,7 @@
* Critical MoodleBox operation details, such as remaining disk space on the SD card and processor load, temperature and frequency
* Current settings of Wi-Fi network supplied by the MoodleBox
* Number, IP and MAC addresses of all devices connected to the MoodleBox
* Number, IP address, name and MAC address of all devices connected to the MoodleBox
* Raspberry Pi model and operating system
* MoodleBox version and MoodleBox plugin version
';
Expand Down Expand Up @@ -123,6 +124,7 @@
$string['systeminfo'] = 'System information';
$string['undervoltagedetected'] = '<p><b>Warning: under-voltage detected!</b> The power supply of the MoodleBox is inadequate, which can cause various problems, for example a limitation of the number of Wi-Fi clients or even an unexpected shutdown of the device.</p><p>It is strongly recommended to <b>change your power supply</b>, giving preference to the official <a href="https://www.raspberrypi.com/products/micro-usb-power-supply/" target="_blank">Raspberry Pi 12.5W Micro USB Power Supply</a> for Raspberry Pi 3A+, 3B, 3B+ and Zero 2 W, or <a href="https://www.raspberrypi.com/products/type-c-power-supply/" target="_blank">Raspberry Pi 15W USB-C Power Supply</a> for Raspberry Pi 4B, or <a href="https://www.raspberrypi.com/products/27w-power-supply/" target="_blank">Raspberry Pi 27W USB-C Power Supply</a> for Raspberry Pi 5.</p>';
$string['undervoltageoccurred'] = '<p>An under-voltage situation has occurred since last boot of the MoodleBox. This could indicate the power supply of the MoodleBox is inadequate, which can cause various problems, for example a limitation of the number of Wi-Fi clients or even an unexpected shutdown of the device.</p><p>It is strongly recommended to <b>change your power supply</b>, giving preference to the official <a href="https://www.raspberrypi.com/products/micro-usb-power-supply/" target="_blank">Raspberry Pi 12.5W Micro USB Power Supply</a> for Raspberry Pi 3A+, 3B, 3B+ and Zero 2 W, or <a href="https://www.raspberrypi.com/products/type-c-power-supply/" target="_blank">Raspberry Pi 15W USB-C Power Supply</a> for Raspberry Pi 4B, or <a href="https://www.raspberrypi.com/products/27w-power-supply/" target="_blank">Raspberry Pi 27W USB-C Power Supply</a> for Raspberry Pi 5.</p>';
$string['unknowndhcpname'] = '<UNKNOWN>';
$string['unknownmodel'] = 'Unknown or unsupported Raspberry Pi model';
$string['unsupportedhardware'] = 'Unsupported server hardware detected! This plugin does only work on Raspberry Pi';
$string['uptime'] = 'System uptime';
Expand Down

0 comments on commit 0c5ea2c

Please sign in to comment.