Skip to content

Commit ec6e90a

Browse files
authored
fix getting wp core version string via ssh (future-architect#1344)
* fix getting wp core version string via ssh * check DocRoot
1 parent 2aca2e4 commit ec6e90a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scanner/base.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -747,9 +747,10 @@ func (l *base) scanWordPress() error {
747747
return nil
748748
}
749749
l.log.Info("Scanning WordPress...")
750-
cmd := fmt.Sprintf("sudo -u %s -i -- %s cli version --allow-root",
750+
cmd := fmt.Sprintf("sudo -u %s -i -- %s core version --path=%s --allow-root",
751751
l.ServerInfo.WordPress.OSUser,
752-
l.ServerInfo.WordPress.CmdPath)
752+
l.ServerInfo.WordPress.CmdPath,
753+
l.ServerInfo.WordPress.DocRoot)
753754
if r := exec(l.ServerInfo, cmd, noSudo); !r.isSuccess() {
754755
return xerrors.Errorf("Failed to exec `%s`. Check the OS user, command path of wp-cli, DocRoot and permission: %#v", cmd, l.ServerInfo.WordPress)
755756
}
@@ -791,7 +792,7 @@ func (l *base) detectWordPress() (*models.WordPressPackages, error) {
791792
}
792793

793794
func (l *base) detectWpCore() (string, error) {
794-
cmd := fmt.Sprintf("sudo -u %s -i -- %s core version --path=%s --allow-root",
795+
cmd := fmt.Sprintf("sudo -u %s -i -- %s core version --path=%s --allow-root 2>/dev/null",
795796
l.ServerInfo.WordPress.OSUser,
796797
l.ServerInfo.WordPress.CmdPath,
797798
l.ServerInfo.WordPress.DocRoot)

0 commit comments

Comments
 (0)