MDL-38173 Courselib: Improve the performance of the upgrade step by joining on course and only running for affected sites.