Merge pull request #9249 from murrant/ns-collision

Config class collides with Config in model namespace
This commit is contained in:
TheGreatDoc
2018-09-21 17:46:08 +02:00
committed by GitHub

View File

@ -3,10 +3,9 @@
namespace App\Models;
use Fico7489\Laravel\Pivot\Traits\PivotEventTrait;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\Query\JoinClause;
use LibreNMS\Config;
use LibreNMS\Exceptions\InvalidIpException;
use LibreNMS\Util\IP;
use LibreNMS\Util\IPv4;
@ -144,7 +143,7 @@ class Device extends BaseModel
*/
public function displayName()
{
if (Config::get('force_ip_to_sysname') && $this->sysName && IP::isValid($this->hostname)) {
if (\LibreNMS\Config::get('force_ip_to_sysname') && $this->sysName && IP::isValid($this->hostname)) {
return $this->sysName;
}
@ -167,7 +166,7 @@ class Device extends BaseModel
return $name;
}
$length = Config::get('shorthost_target_length', $length);
$length = \LibreNMS\Config::get('shorthost_target_length', $length);
if ($length < strlen($name)) {
$take = substr_count($name, '.', 0, $length) + 1;
return implode('.', array_slice(explode('.', $name), 0, $take));