Script execution list

This commit is contained in:
Magnus Åhall 2025-08-08 18:15:13 +02:00
parent 13a5b9a973
commit 55724b36b5
8 changed files with 517 additions and 14 deletions

View file

@ -226,7 +226,7 @@ func ScheduleHook(hookID int) (err error) { // {{{
return
}
scriptLogID, err := ScriptPreservedID(hook.Script.Source)
scriptLogID, err := ScriptPreservedID(hook.Script.Name, hook.Script.Source)
if err != nil {
err = werr.Wrap(err)
return
@ -260,7 +260,7 @@ func ScheduleHook(hookID int) (err error) { // {{{
return
} // }}}
func ScriptPreservedID(source string) (id int, err error) { // {{{
func ScriptPreservedID(name, source string) (id int, err error) { // {{{
sum := md5.Sum([]byte(source))
md5sum := hex.EncodeToString(sum[:])
@ -274,7 +274,7 @@ func ScriptPreservedID(source string) (id int, err error) { // {{{
return
}
row = db.QueryRow(`INSERT INTO script_log(md5sum, source) VALUES($1, $2) RETURNING id`, md5sum, source)
row = db.QueryRow(`INSERT INTO script_log(md5sum, name, source) VALUES($1, $2, $3) RETURNING id`, md5sum, name, source)
err = row.Scan(&id)
if err != nil {
err = werr.Wrap(err)