|
1 |
| -<?php namespace System\Classes; |
2 |
| - |
3 |
| -use Db; |
4 |
| -use App; |
5 |
| -use Str; |
6 |
| -use Log; |
7 |
| -use File; |
8 |
| -use Lang; |
9 |
| -use View; |
10 |
| -use Cache; |
11 |
| -use Config; |
12 |
| -use Schema; |
13 |
| -use SystemException; |
| 1 | +<?php |
| 2 | + |
| 3 | +namespace System\Classes; |
| 4 | + |
| 5 | +use Backend\Classes\NavigationManager; |
14 | 6 | use FilesystemIterator;
|
15 |
| -use RecursiveIteratorIterator; |
| 7 | +use Illuminate\Database\QueryException; |
| 8 | +use Illuminate\Support\Facades\App; |
| 9 | +use Illuminate\Support\Facades\Cache; |
| 10 | +use Illuminate\Support\Facades\DB; |
| 11 | +use Illuminate\Support\Facades\Lang; |
| 12 | +use Illuminate\Support\Facades\Log; |
| 13 | +use Illuminate\Support\Facades\View; |
16 | 14 | use RecursiveDirectoryIterator;
|
| 15 | +use RecursiveIteratorIterator; |
17 | 16 | use System\Models\PluginVersion;
|
| 17 | +use SystemException; |
18 | 18 | use Winter\Storm\Foundation\Application;
|
19 | 19 | use Winter\Storm\Support\ClassLoader;
|
20 |
| -use Backend\Classes\NavigationManager; |
| 20 | +use Winter\Storm\Support\Facades\Config; |
| 21 | +use Winter\Storm\Support\Facades\File; |
| 22 | +use Winter\Storm\Support\Str; |
21 | 23 |
|
22 | 24 | /**
|
23 | 25 | * Plugin manager
|
@@ -256,8 +258,15 @@ public function registerAll(bool $force = false): void
|
256 | 258 | return;
|
257 | 259 | }
|
258 | 260 |
|
259 |
| - foreach ($this->plugins as $pluginId => $plugin) { |
260 |
| - $this->registerPlugin($plugin, $pluginId); |
| 261 | + try { |
| 262 | + foreach ($this->plugins as $pluginId => $plugin) { |
| 263 | + $this->registerPlugin($plugin, $pluginId); |
| 264 | + } |
| 265 | + } catch (QueryException $ex) { |
| 266 | + // SQLSTATE[42S02]: Base table or view not found - migrations haven't run yet |
| 267 | + if ($ex->getCode() === '42S02') { |
| 268 | + Log::error("$pluginId cannot be registered, missing database content. Try running migrations. Error: " . $ex->getMessage()); |
| 269 | + } |
261 | 270 | }
|
262 | 271 |
|
263 | 272 | // Ensure that route attributes are properly loaded
|
@@ -372,8 +381,15 @@ public function bootAll(bool $force = false): void
|
372 | 381 | return;
|
373 | 382 | }
|
374 | 383 |
|
375 |
| - foreach ($this->plugins as $plugin) { |
376 |
| - $this->bootPlugin($plugin); |
| 384 | + try { |
| 385 | + foreach ($this->plugins as $pluginId => $plugin) { |
| 386 | + $this->bootPlugin($plugin); |
| 387 | + } |
| 388 | + } catch (QueryException $ex) { |
| 389 | + // SQLSTATE[42S02]: Base table or view not found - migrations haven't run yet |
| 390 | + if ($ex->getCode() === '42S02') { |
| 391 | + Log::error("$pluginId cannot be booted, missing database content. Try running migrations. Error: " . $ex->getMessage()); |
| 392 | + } |
377 | 393 | }
|
378 | 394 |
|
379 | 395 | $this->booted = true;
|
@@ -664,7 +680,7 @@ protected function loadDisabled(): void
|
664 | 680 | if (
|
665 | 681 | $this->app->hasDatabaseTable('system_plugin_versions')
|
666 | 682 | ) {
|
667 |
| - $userDisabled = Db::table('system_plugin_versions')->where('is_disabled', 1)->lists('code') ?? []; |
| 683 | + $userDisabled = DB::table('system_plugin_versions')->where('is_disabled', 1)->lists('code') ?? []; |
668 | 684 | foreach ($userDisabled as $code) {
|
669 | 685 | $this->flagPlugin($code, static::DISABLED_BY_USER);
|
670 | 686 | }
|
|
0 commit comments