Skip to content

Commit

Permalink
Add test to avoid warnings when missing interface (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
martignoni authored Oct 28, 2024
1 parent 3c67774 commit adf8af7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __This version is not compatible with versions of Moodle prior to Moodle 4.4!__

### Fixed
- Channels 12 and 13 for wireless AP can be selected (issue #143).
- Avoid warnings when not Ethernet interface on device (issue #148).

## Version 2.18.1, 2024-10-13

Expand Down
7 changes: 5 additions & 2 deletions classes/local/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ public static function get_ethernet_interface_name() {
$iter = new \RecursiveIteratorIterator($iter, \RecursiveIteratorIterator::CHILD_FIRST);
$iter = new \RegexIterator($iter, '|^.*/device$|i', \RecursiveRegexIterator::GET_MATCH);
$iter->setMaxDepth(2);
$matches = array_values(preg_grep('#^.*/(eth|en).*$#i', array_keys(iterator_to_array($iter))))[0];
return explode('/', $matches)[4];
if ( $matches = array_values(preg_grep('#^.*/(eth|en).*$#i', array_keys(iterator_to_array($iter)))) ) {
return explode('/', $matches[0])[4];
} else {
return false;
}
} else {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

$plugin = new stdClass();

$plugin->version = 2024102700;
$plugin->release = '2.18.2-beta';
$plugin->version = 2024102800;
$plugin->release = '2.18.2-beta2';
$plugin->requires = 2024042200;
$plugin->supported = [404, 405];
$plugin->maturity = MATURITY_BETA;
Expand Down

0 comments on commit adf8af7

Please sign in to comment.