e5184cac0e
By holding onto a reference of the global $CFG object we can be sure that it isn't destroyed before we are done with it. This allows for caches to be used within destructors for purposes such as delayed writes.