Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #15837: After upgrade plugins are duplicated
InstalledPlugins variable had the wrong form.
- Loading branch information
1 parent
7dc7fcf
commit ea06049
Showing
1 changed file
with
26 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3018,21 +3018,38 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false) | |
|
||
if ($iOldDBVersion < 424) { | ||
$oTransaction = $oDB->beginTransaction(); | ||
$installedPlugins = $oDB->createCommand('SELECT name FROM {{plugins}}')->queryAll(); | ||
$installedPlugins = array_map( | ||
function ($v) { | ||
return $v['name']; | ||
}, | ||
$oDB->createCommand('SELECT name FROM {{plugins}}')->queryAll() | ||
); | ||
/** | ||
* @param string $name Name of plugin | ||
* @param int $active | ||
*/ | ||
$insertPlugin = function ($name, $active = 0) use ($installedPlugins, $oDB) { | ||
if (!in_array($name, $installedPlugins)) { | ||
$oDB->createCommand()->insert("{{plugins}}", [ | ||
'name' => $name, | ||
'plugin_type' => 'core', | ||
'active' => $active, | ||
'version' => '1.0.0', | ||
'load_error' => 0, | ||
'load_error_message' => null | ||
]); | ||
$oDB->createCommand()->insert( | ||
"{{plugins}}", | ||
[ | ||
'name' => $name, | ||
'plugin_type' => 'core', | ||
'active' => $active, | ||
'version' => '1.0.0', | ||
'load_error' => 0, | ||
'load_error_message' => null | ||
] | ||
); | ||
} else { | ||
$oDB->createCommand()->update( | ||
"{{plugins}}", | ||
[ | ||
'plugin_type' => 'core', | ||
'version' => '1.0.0', | ||
], | ||
"`name`='{$name}'" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Shnoulle
Collaborator
|
||
); | ||
} | ||
}; | ||
$insertPlugin('AuthLDAP'); | ||
|
Warning with SQL : https://bugs.limesurvey.org/view.php?id=17084 :)
Here : not needed, else App()->getDb()->quoteColumnName('name');
;)