Auto-Upgrade to 4.2.2 fails because theme functions.php is included instead of wp-includes/functions.php

I am not confident your guess at “being included instead” is accurate. The inclusion of core file is hardcoded in wp-settings.php pretty hard, it would be extremely challenging to subvert under normal circumstances.

I have trouble imaging scenario in which functions.php of the theme will be loaded, but add_action() will be unavailable. This simply shouldn’t ever happen under normal mechanics.

My best guess is that your installation is strangely customized or otherwise corrupt.

I would start looking into specifics of strange theme’s functions.php load, probably by dumping wp_debug_backtrace() from there for starters.

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