Why does my function create extra empty files?

The problematic line is the one for the transition_post_status action’s callback as the input parameter is post status (string) but not post ID (integer):

https://developer.wordpress.org/reference/hooks/transition_post_status/

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