Skip to content

Commit

Permalink
Fix an error that could prevent default plugins from being installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisWiegman committed Aug 4, 2024
1 parent 1c6ea49 commit b349a15
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions internal/site/wordpress.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,28 +282,30 @@ func (s *Site) installDefaultPlugins(consoleOutput *console.Console) error {
}

for _, plugin := range s.settings.GetSlice("plugins") {
var setupCommand []string
setupCommand := []string{
"plugin",
"install",
"--activate",
plugin,
}

for _, installedPlugin := range installedPlugins {
if installedPlugin == plugin {
setupCommand = []string{
"plugin",
"install",
"--activate",
plugin,
}
setupCommand = []string{}
}
}

consoleOutput.Println(fmt.Sprintf("Installing plugin: %s", consoleOutput.Bold(consoleOutput.Blue(plugin))))
if len(setupCommand) > 0 {
consoleOutput.Println(fmt.Sprintf("Installing plugin: %s", consoleOutput.Bold(consoleOutput.Blue(plugin))))

code, _, err := s.WPCli(setupCommand, false, consoleOutput)
if err != nil {
return err
}
code, _, err := s.WPCli(setupCommand, false, consoleOutput)
if err != nil {
return err
}

if code != 0 {
consoleOutput.Warn(fmt.Sprintf("Unable to install plugin: %s.", consoleOutput.Bold(consoleOutput.Blue(plugin))))
if code != 0 {
consoleOutput.Warn(fmt.Sprintf("Unable to install plugin: %s.", consoleOutput.Bold(consoleOutput.Blue(plugin))))
}
}
}

Expand Down

0 comments on commit b349a15

Please sign in to comment.