Fix deprecated function warning with latest Moodle.