mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Stop looping after the file is found, otherwise $config might contain another path then the one where te file is found. This causes problems when $config is used as working directory for fetching changes in git. (#10942)
Also, this is a small performance improvement.
This commit is contained in:
committed by
Kevin Krumm
parent
b2137787fb
commit
5bf56db50a
@@ -17,12 +17,15 @@ if (Auth::user()->hasGlobalAdmin()) {
|
|||||||
|
|
||||||
if (is_file($configs.$device['hostname'])) {
|
if (is_file($configs.$device['hostname'])) {
|
||||||
$file = $configs.$device['hostname'];
|
$file = $configs.$device['hostname'];
|
||||||
|
break;
|
||||||
} elseif (is_file($configs.strtok($device['hostname'], '.'))) { // Strip domain
|
} elseif (is_file($configs.strtok($device['hostname'], '.'))) { // Strip domain
|
||||||
$file = $configs.strtok($device['hostname'], '.');
|
$file = $configs.strtok($device['hostname'], '.');
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (!empty(Config::get('mydomain'))) { // Try with domain name if set
|
if (!empty(Config::get('mydomain'))) { // Try with domain name if set
|
||||||
if (is_file($configs.$device['hostname'].'.'.Config::get('mydomain'))) {
|
if (is_file($configs.$device['hostname'].'.'.Config::get('mydomain'))) {
|
||||||
$file = $configs.$device['hostname'].'.'.Config::get('mydomain');
|
$file = $configs.$device['hostname'].'.'.Config::get('mydomain');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end if
|
} // end if
|
||||||
|
|||||||
Reference in New Issue
Block a user