Function updateSettingsFile
Update the Settings.php file.
The most important function in this file for mod makers happens to be the updateSettingsFile() function, but it shouldn't be used often anyway.
Updates the Settings.php file with the changes supplied in config_vars.
Expects config_vars to be an associative array, with the keys as the variable names in Settings.php, and the values the variable values.
Correctly formats the values using smf_var_export().
Restores standard formatting of the file, if $rebuild is true.
Checks for changes to db_last_error and passes those off to a separate handler.
Creates a backup file and will use it should the writing of the new settings file fail.
Tries to intelligently trim quotes and remove slashes from string values. This is done for backwards compatibility purposes (old versions of this function expected strings to have been manually escaped and quoted). This behaviour can be controlled by the $keep_quotes parameter.
Copyright: 2020 Simple Machines and individual contributors
License: BSD
Author: Simple Machines https://www.simplemachines.org
Located at Sources/Subs-Admin.php
array |
$config_vars |
An array of one or more variables to update. |
boolean|null |
$keep_quotes = null |
Whether to strip slashes & trim quotes from string values. Defaults to auto-detection. |
boolean |
$rebuild = false |
If true, attempts to rebuild with standard format. Default false. |
boolean
|
True on success, false on failure. |