|
2 | 2 |
|
3 | 3 | namespace Pterodactyl\Providers; |
4 | 4 |
|
| 5 | +use Illuminate\Contracts\Logging\Log; |
| 6 | +use Illuminate\Database\QueryException; |
5 | 7 | use Illuminate\Support\ServiceProvider; |
6 | 8 | use Illuminate\Contracts\Encryption\Encrypter; |
7 | 9 | use Illuminate\Contracts\Encryption\DecryptException; |
@@ -60,19 +62,26 @@ class SettingsServiceProvider extends ServiceProvider |
60 | 62 | * |
61 | 63 | * @param \Illuminate\Contracts\Config\Repository $config |
62 | 64 | * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter |
| 65 | + * @param \Illuminate\Contracts\Logging\Log $log |
63 | 66 | * @param \Pterodactyl\Contracts\Repository\SettingsRepositoryInterface $settings |
64 | 67 | */ |
65 | | - public function boot(ConfigRepository $config, Encrypter $encrypter, SettingsRepositoryInterface $settings) |
| 68 | + public function boot(ConfigRepository $config, Encrypter $encrypter, Log $log, SettingsRepositoryInterface $settings) |
66 | 69 | { |
67 | 70 | // Only set the email driver settings from the database if we |
68 | 71 | // are configured using SMTP as the driver. |
69 | 72 | if ($config->get('mail.driver') === 'smtp') { |
70 | 73 | $this->keys = array_merge($this->keys, $this->emailKeys); |
71 | 74 | } |
72 | 75 |
|
73 | | - $values = $settings->all()->mapWithKeys(function ($setting) { |
74 | | - return [$setting->key => $setting->value]; |
75 | | - })->toArray(); |
| 76 | + try { |
| 77 | + $values = $settings->all()->mapWithKeys(function ($setting) { |
| 78 | + return [$setting->key => $setting->value]; |
| 79 | + })->toArray(); |
| 80 | + } catch (QueryException $exception) { |
| 81 | + $log->notice('A query exception was encountered while trying to load settings from the database.'); |
| 82 | + |
| 83 | + return; |
| 84 | + } |
76 | 85 |
|
77 | 86 | foreach ($this->keys as $key) { |
78 | 87 | $value = array_get($values, 'settings::' . $key, $config->get(str_replace(':', '.', $key))); |
|
0 commit comments