CC-5810 : Installation can have race conditions with the cache

Preferences.php is used to set values since it will save the value to cache there as well.

defaultdata.sql is used where possible.