9632db7aea
Credit goes to James Brisland for the submitted patch. I just polished it a bit and changed the SQL condition that selects the site course record from id=1 to format='site' (see xmldb_main_install() for how the site course record is initialised, we should not rely on the id assigned to it by the DB engine).