MDL-31989 call a function from lib instead of include connection.php