fix: respect PLUGIN_PATH when checking if a plugin trigger exists
Without this, upgrades may fail if the user has enabled a plugin which implements a trigger that is checked for during an upgrade.
This commit is contained in:
@@ -132,12 +132,13 @@ func PlugnTriggerSetup(triggerName string, args ...string) *sh.Session {
|
|||||||
|
|
||||||
// PlugnTriggerExists returns whether a plugin trigger exists (ignoring the existence of any within the 20_events plugin)
|
// PlugnTriggerExists returns whether a plugin trigger exists (ignoring the existence of any within the 20_events plugin)
|
||||||
func PlugnTriggerExists(triggerName string) bool {
|
func PlugnTriggerExists(triggerName string) bool {
|
||||||
pluginPath := MustGetEnv("PLUGIN_ENABLED_PATH")
|
pluginPath := MustGetEnv("PLUGIN_PATH")
|
||||||
glob := filepath.Join(pluginPath, "*", triggerName)
|
pluginPathPrefix := filepath.Join(pluginPath, "enabled")
|
||||||
|
glob := filepath.Join(pluginPathPrefix, "*", triggerName)
|
||||||
exists := false
|
exists := false
|
||||||
files, _ := filepath.Glob(glob)
|
files, _ := filepath.Glob(glob)
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
plugin := strings.Trim(strings.TrimPrefix(strings.TrimSuffix(file, "/"+triggerName), pluginPath), "/")
|
plugin := strings.Trim(strings.TrimPrefix(strings.TrimSuffix(file, "/"+triggerName), pluginPathPrefix), "/")
|
||||||
if plugin != "20_events" {
|
if plugin != "20_events" {
|
||||||
exists = true
|
exists = true
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user