mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-10-06 01:21:57 -04:00
Added check for plugin table before attempting to load plugins
Signed-off-by: objec <objecttothis@gmail.com>
This commit is contained in:
1 parent
a19fe03ecf
commit
84ea65b1bd
2 files changed
+14
-2
No files matched your search
@@ -56,8 +56,13 @@ Events::on('pre_system', static function (): void {
|
||||
}
|
||||
|
||||
$pluginManager = new PluginManager();
|
||||
$pluginManager->discoverPlugins();
|
||||
$pluginManager->registerPluginEvents();
|
||||
|
||||
if ($pluginManager->canLoadPlugins()) {
|
||||
$pluginManager->discoverPlugins();
|
||||
$pluginManager->registerPluginEvents();
|
||||
} else {
|
||||
log_message('debug', 'Plugin loading is disabled until after migration has been run.');
|
||||
}
|
||||
});
|
||||
|
||||
$config = new Load_config();
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Libraries\Plugins;
|
||||
|
||||
use App\Models\PluginConfig;
|
||||
use CodeIgniter\Events\Events;
|
||||
use Config\Database;
|
||||
use Config\Services;
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
@@ -109,6 +110,12 @@ class PluginManager
|
||||
return $enabled === '1' || $enabled === 'true';
|
||||
}
|
||||
|
||||
public function canLoadPlugins(): bool
|
||||
{
|
||||
$db = Database::connect();
|
||||
return $db->tableExists('plugin_config');
|
||||
}
|
||||
|
||||
public function enablePlugin(string $pluginId): bool
|
||||
{
|
||||
$plugin = $this->getPlugin($pluginId);
|
||||
|
||||
Reference in new issue
Block a user