mirror of https://github.com/1Panel-dev/1Panel
parent
aa222aac31
commit
34e14636d4
|
@ -81,6 +81,7 @@ func (c *ClamService) LoadBaseInfo() (dto.ClamBaseInfo, error) {
|
||||||
}
|
}
|
||||||
if !cmd.Which("clamdscan") {
|
if !cmd.Which("clamdscan") {
|
||||||
baseInfo.IsActive = false
|
baseInfo.IsActive = false
|
||||||
|
stopAllCronJob()
|
||||||
}
|
}
|
||||||
|
|
||||||
if baseInfo.IsActive {
|
if baseInfo.IsActive {
|
||||||
|
@ -268,7 +269,8 @@ func (c *ClamService) Delete(req dto.ClamDelete) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ClamService) HandleOnce(req dto.OperateByID) error {
|
func (c *ClamService) HandleOnce(req dto.OperateByID) error {
|
||||||
if cmd.Which("clamdscan") == false {
|
if !cmd.Which("clamdscan") {
|
||||||
|
stopAllCronJob()
|
||||||
return buserr.New("ErrClamdscanNotFound")
|
return buserr.New("ErrClamdscanNotFound")
|
||||||
}
|
}
|
||||||
clam, _ := clamRepo.Get(commonRepo.WithByID(req.ID))
|
clam, _ := clamRepo.Get(commonRepo.WithByID(req.ID))
|
||||||
|
@ -473,6 +475,14 @@ func (c *ClamService) UpdateFile(req dto.UpdateByNameAndFile) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func stopAllCronJob() {
|
||||||
|
clams, _ := clamRepo.List(commonRepo.WithByStatus(constant.StatusEnable))
|
||||||
|
for i := 0; i < len(clams); i++ {
|
||||||
|
global.Cron.Remove(cron.EntryID(clams[i].EntryID))
|
||||||
|
_ = clamRepo.Update(clams[i].ID, map[string]interface{}{"status": constant.StatusDisable, "entry_id": 0})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func loadFileByName(name string) []string {
|
func loadFileByName(name string) []string {
|
||||||
var logPaths []string
|
var logPaths []string
|
||||||
pathItem := path.Join(global.CONF.System.DataDir, resultDir, name)
|
pathItem := path.Join(global.CONF.System.DataDir, resultDir, name)
|
||||||
|
|
Loading…
Reference in New Issue