mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
f1e7a218f0
* Convert Config to a singleton Continuation of #14364 by @Jellyfrog This time, make the old class a shim for the facade. Will update references in a separate PR. * Remove logging config call * Apply fixes from StyleCI * Fix bad Git constructor call * Fail on config table does not exist instead of throw exception * Inline LibrenmsConfig::isRegistered() * Debug call in case there are more issues, remove before merge. * Fix up config tests * Allow config cache controlled by CONFIG_CACHE_TTL (disabled by default for now) * Enable config cache for tests * Remove debug statement and deprecation phpdoc * Apply fixes from StyleCI --------- Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* LibrenmsConfig.php
|
|
*
|
|
* -Description-
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*
|
|
* @link https://www.librenms.org
|
|
*
|
|
* @copyright 2019 Tony Murray
|
|
* @author Tony Murray <murraytony@gmail.com>
|
|
*/
|
|
|
|
namespace App\Facades;
|
|
|
|
use Illuminate\Support\Facades\App;
|
|
use Illuminate\Support\Facades\Facade;
|
|
|
|
class LibrenmsConfig extends Facade
|
|
{
|
|
protected static function getFacadeAccessor(): string
|
|
{
|
|
return 'librenms-config';
|
|
}
|
|
|
|
public static function reload(): void
|
|
{
|
|
App::forgetInstance('librenms-config'); // clear singleton
|
|
self::clearResolvedInstances(); // clear facade resolved instances cache
|
|
}
|
|
}
|