Replace missing methods.

This commit is contained in:
James Cole
2025-03-08 15:57:59 +01:00
parent a8f36a2490
commit cd08c16dee
10 changed files with 31 additions and 21 deletions

View File

@@ -27,6 +27,7 @@ use Illuminate\Console\Command;
class ValidatesEnvironmentVariables extends Command
{
use ShowsFriendlyMessages;
/**
* The name and signature of the console command.
*
@@ -37,7 +38,7 @@ class ValidatesEnvironmentVariables extends Command
/**
* The console command description.
*
* @var string
* @var string|null
*/
protected $description = 'Makes sure you use the correct variables.';
@@ -54,17 +55,18 @@ class ValidatesEnvironmentVariables extends Command
private function validateLanguage(): void
{
$language = env('DEFAULT_LANGUAGE', 'en_US');
$locale = env('DEFAULT_LOCALE', 'equal');
$language = config('firefly.default_language');
$locale = config('firefly.default_locale');
$options = array_keys(config('firefly.languages'));
if (!in_array($language, $options)) {
if (!in_array($language, $options, true)) {
$this->friendlyError(sprintf('DEFAULT_LANGUAGE "%s" is not a valid language for Firefly III.', $language));
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
$this->friendlyError(sprintf('Valid languages are: %s', implode(', ', $options)));
exit(1);
}
$options[] = 'equal';
if (!in_array($locale, $options)) {
if (!in_array($locale, $options, true)) {
$this->friendlyError(sprintf('DEFAULT_LOCALE "%s" is not a valid local for Firefly III.', $locale));
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
$this->friendlyError(sprintf('Valid locales are: %s', implode(', ', $options)));
@@ -72,9 +74,10 @@ class ValidatesEnvironmentVariables extends Command
}
}
private function validateGuard(): void {
$guard = env('AUTHENTICATION_GUARD','web');
if('web' !== $guard && 'remote_user_guard' !== $guard) {
private function validateGuard(): void
{
$guard = env('AUTHENTICATION_GUARD', 'web');
if ('web' !== $guard && 'remote_user_guard' !== $guard) {
$this->friendlyError(sprintf('AUTHENTICATION_GUARD "%s" is not a valid guard for Firefly III.', $guard));
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
$this->friendlyError('Valid guards are: web, remote_user_guard');
@@ -82,9 +85,10 @@ class ValidatesEnvironmentVariables extends Command
}
}
private function validateStaticToken(): void {
$token = (string) env('STATIC_CRON_TOKEN','');
if(0 !== strlen($token) && 32 !== strlen($token)) {
private function validateStaticToken(): void
{
$token = (string) env('STATIC_CRON_TOKEN', '');
if (0 !== strlen($token) && 32 !== strlen($token)) {
$this->friendlyError('STATIC_CRON_TOKEN must be empty or a 32-character string.');
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
exit(1);