Refactor heartbeat to delegate to the modulestores and sql

LMS-2801

Refactored scalable heartbeat which still does something useful and is equivalent in functionality as far as xml backed courses are concerned but doesn't return the course ids.

@ormsbee @nedbat @e0d first 2 to review win.