mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-26 19:00:22 -06:00
Slightly more robust configuration polling.
This commit is contained in:
parent
4271dc1638
commit
26d19fab32
@ -43,8 +43,9 @@ trait UpdateTrait
|
||||
{
|
||||
Log::debug('Now in getLatestRelease()');
|
||||
/** @var UpdateRequestInterface $checker */
|
||||
$checker = app(UpdateRequestInterface::class);
|
||||
$channel = app('fireflyconfig')->get('update_channel', 'stable')->data;
|
||||
$checker = app(UpdateRequestInterface::class);
|
||||
$channelConfig = app('fireflyconfig')->get('update_channel', 'stable');
|
||||
$channel = $channelConfig ? $channelConfig->data : 'stable';
|
||||
|
||||
return $checker->getUpdateInformation($channel);
|
||||
}
|
||||
|
@ -55,7 +55,8 @@ class Controller extends BaseController
|
||||
public function __construct()
|
||||
{
|
||||
// is site a demo site?
|
||||
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', false,),)->data;
|
||||
$isDemoSiteConfig = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', false,),);
|
||||
$isDemoSite = $isDemoSiteConfig ? $isDemoSiteConfig->data : false;
|
||||
app('view')->share('IS_DEMO_SITE', $isDemoSite,);
|
||||
app('view')->share('DEMO_USERNAME', config('firefly.demo_username'));
|
||||
app('view')->share('DEMO_PASSWORD', config('firefly.demo_password'));
|
||||
|
@ -121,25 +121,26 @@ class DebugController extends Controller
|
||||
$search = ['~', '#'];
|
||||
$replace = ['\~', '# '];
|
||||
|
||||
$now = Carbon::now()->format('Y-m-d H:i:s e');
|
||||
$installationId = app('fireflyconfig')->get('installation_id', '')->data;
|
||||
$phpVersion = str_replace($search, $replace, PHP_VERSION);
|
||||
$phpOs = str_replace($search, $replace, PHP_OS);
|
||||
$interface = PHP_SAPI;
|
||||
$drivers = implode(', ', DB::availableDrivers());
|
||||
$currentDriver = DB::getDriverName();
|
||||
$userAgent = $request->header('user-agent');
|
||||
$trustedProxies = config('firefly.trusted_proxies');
|
||||
$displayErrors = ini_get('display_errors');
|
||||
$errorReporting = $this->errorReporting((int) ini_get('error_reporting'));
|
||||
$appEnv = config('app.env');
|
||||
$appDebug = var_export(config('app.debug'), true);
|
||||
$logChannel = config('logging.default');
|
||||
$appLogLevel = config('logging.level');
|
||||
$cacheDriver = config('cache.default');
|
||||
$loginProvider = config('auth.providers.users.driver');
|
||||
$bcscale = bcscale();
|
||||
$layout = env('FIREFLY_III_LAYOUT');
|
||||
$now = Carbon::now()->format('Y-m-d H:i:s e');
|
||||
$installationIdConfig = app('fireflyconfig')->get('installation_id', '');
|
||||
$installationId = $installationIdConfig ? $installationIdConfig->data : '';
|
||||
$phpVersion = str_replace($search, $replace, PHP_VERSION);
|
||||
$phpOs = str_replace($search, $replace, PHP_OS);
|
||||
$interface = PHP_SAPI;
|
||||
$drivers = implode(', ', DB::availableDrivers());
|
||||
$currentDriver = DB::getDriverName();
|
||||
$userAgent = $request->header('user-agent');
|
||||
$trustedProxies = config('firefly.trusted_proxies');
|
||||
$displayErrors = ini_get('display_errors');
|
||||
$errorReporting = $this->errorReporting((int) ini_get('error_reporting'));
|
||||
$appEnv = config('app.env');
|
||||
$appDebug = var_export(config('app.debug'), true);
|
||||
$logChannel = config('logging.default');
|
||||
$appLogLevel = config('logging.level');
|
||||
$cacheDriver = config('cache.default');
|
||||
$loginProvider = config('auth.providers.users.driver');
|
||||
$bcscale = bcscale();
|
||||
$layout = env('FIREFLY_III_LAYOUT');
|
||||
|
||||
// some new vars.
|
||||
$telemetry = true === config('firefly.send_telemetry') && true === config('firefly.feature_flags.telemetry');
|
||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Support;
|
||||
|
||||
use Cache;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Configuration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Log;
|
||||
@ -67,9 +68,10 @@ class FireflyConfig
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $default
|
||||
* @param null $default
|
||||
*
|
||||
* @return \FireflyIII\Models\Configuration|null
|
||||
* @throws FireflyException
|
||||
* @return Configuration|null
|
||||
*/
|
||||
public function get(string $name, $default = null): ?Configuration
|
||||
{
|
||||
@ -82,10 +84,12 @@ class FireflyConfig
|
||||
}
|
||||
|
||||
try {
|
||||
/** @var Configuration $config */
|
||||
$config = Configuration::where('name', $name)->first(['id', 'name', 'data']);
|
||||
} catch (QueryException|Exception $e) {
|
||||
Log::error(sprintf('Query exception while polling for config var: %s', $e->getMessage()));
|
||||
return null;
|
||||
Log::error($e->getTraceAsString());
|
||||
throw new FireflyException(sprintf('Could not poll the database: %s', $e->getMessage()));
|
||||
}
|
||||
|
||||
if ($config) {
|
||||
|
Loading…
Reference in New Issue
Block a user