Is there a before_save_post hook or something similar

There is a hook called transition_post_status which runs at every transition. You have both the old and new status available inside the hook.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)