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