This pull request fixes an error when the settings object is assigned to a singular variable of `$setting` instead of `$settings`. This makes the included files run potentially the wrong domain name.
Optimize the `upgrade()` method of the `domains.php` to reduce filesystem operations.