private static function Settings::reloadVars in Hook Update Deploy Tools 8
Same name and namespace in other branches
- 7 src/Settings.php \HookUpdateDeployTools\Settings::reloadVars()
Loads the variables from the db merged with any set in settings.php.
@caution
- This method will not load $conf specified in any settings files that
are included in settings.php using include_once or require_once since they were already included on bootstrap.
- If any function are defined in settings.php or any files included
therein, a fatal error (un-catchable) will occur. settings files should not contain functions.
Return value
array Returns the array drupal variables.
1 call to Settings::reloadVars()
- Settings::confirmSet in src/
Settings.php - Checks to see if the variable was not set.
File
- src/
Settings.php, line 116
Class
- Settings
- Public methods for altering Settings.
Namespace
HookUpdateDeployToolsCode
private static function reloadVars() {
// Get the variables from the Database. Not Global.
$conf = variable_initialize();
$settings_file = DRUPAL_ROOT . '/' . conf_path() . '/settings.php';
if (file_exists($settings_file)) {
// This was already include_once'd in drupal_settings_initialize() so it
// needs to be included in order to load it again.
// @RISK if somebody declares a function in settings.php or any files
// included to it, the include bellow will trigger a fatal error.
include $settings_file;
}
else {
// settings.php was not available for some reason. Not critical.
// Worst case, we get a false positive because $conf overrides are not
// present from settings.php.
$message = "The settings file '!file' could not be loaded. You may get a false positive that your variable set was not overridden.";
Message::make($message, array(
'!file' => $settings_file,
), WATCHDOG_INFO, 1);
}
return $conf;
}