mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Prevent duplicate plugin table entries (#14120)
* Prevent duplicate plugin table entries Some sort of race condition. Add a unique index, this will cause the create query to fail when it tries to add a new entry for an existing plugin. * Add index
This commit is contained in:
@@ -189,7 +189,11 @@ class PluginManager
|
||||
|
||||
if (! $plugin) {
|
||||
try {
|
||||
$plugin = Plugin::create([
|
||||
// plugin should not exist, but check for safety
|
||||
$plugin = Plugin::firstOrCreate([
|
||||
'version' => 2,
|
||||
'plugin_name' => $name,
|
||||
], [
|
||||
'plugin_name' => $name,
|
||||
'plugin_active' => $name !== 'ExamplePlugin',
|
||||
'version' => 2,
|
||||
|
Reference in New Issue
Block a user