function setConfigEntry ($configEntry, $value) {
// Just set it (unsecured won't hurt?)
$GLOBALS['config'][$configEntry] = $value;
+
+ // Remove cache
+ removeGlobalCache($configEntry);
+}
+
+// Removes entry in $GLOBALS
+function removeGlobalCache ($configEntry) {
+ // Generate key
+ $key = 'get' . capitalizeUnderscoreString($configEntry);
+
+ // Remove it
+ unset($GLOBALS[$key]);
}
// Checks whether the given config entry is set
copyFileVerified(getPath() . 'inc/config-local.php.dist', getCachePath() . 'config-local.php', 0644);
// First of all, load the old one!
- $oldConfig = explode(chr(10), readFromFile(getPath() . 'inc/config.php'));
+ $oldConfig = explode(PHP_EOL, readFromFile(getPath() . 'inc/config.php'));
// Now, analyze every entry
$done = array();
// Default comment
$comment = str_replace('_', '-', $new);
- // Do we have a special comment?
+ // Is there a special comment?
if (isset($comments[$new])) {
// Then use it
$comment = $comments[$new];
} // END - if
- // Do we need to make $new lowercase?
+ // Does $new needs to be lower-case?
$oldNew = $new;
if (in_array($new, $lowerCase)) {
// Then do so... :)
} // END - foreach
// By default the old array $MySQL was not found
- $found = false;
+ $found = FALSE;
// Analyze every entry again for the MySQL configuration
foreach ($oldConfig as $line) {
// Is the $MySQL found?
if (substr($line, 0, 6) == '$MySQL') {
// Okay, found
- $found = true;
- } elseif ($found === true) {
+ $found = TRUE;
+ } elseif ($found === TRUE) {
// Now check this row
if (substr($line, 0, 2) == ');') {
// MySQL array is closed so stop looking for it
// Do not update config in CSS mode
if ((isCssOutputMode()) || (isRawOutputMode()) || (isInstallationPhase())) {
// This logger line may be very noisy
- /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not updating configuration. entries[]=' . gettype($entries) . ',values[]=' . gettype($values) . ',updateMode=' . $updateMode . ',config=' . $config . ',isCssOutputMode()=' . intval(isCssOutputMode()) . ',isRawOutputMode()=' . intval(isRawOutputMode()) . ',isInstallationPhase()=' . intval(isInstallationPhase()));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not updating configuration. entries[]=' . gettype($entries) . ',values[]=' . gettype($values) . ',updateMode=' . $updateMode . ',config=' . $config . ',isCssOutputMode()=' . intval(isCssOutputMode()) . ',isRawOutputMode()=' . intval(isRawOutputMode()) . ',isInstallationPhase()=' . intval(isInstallationPhase()));
return;
} // END - if
// Default is empty SQL
$SQL = '';
- // Do we have multiple entries?
+ // Is there multiple entries?
if (is_array($entries)) {
// Walk through all
foreach ($entries as $idx => $entry) {
// Check if string or number but no array
if (is_array($values[$idx])) {
// Arrays must be fixed...
- reportBug(__FUNCTION__, __LINE__, 'values[' . $idx . '] should not be an array! Content=<pre>'.print_r($values[$idx], true).'</pre>');
+ reportBug(__FUNCTION__, __LINE__, 'values[' . $idx . '] should not be an array! Content=<pre>'.print_r($values[$idx], TRUE).'</pre>');
} elseif ($values[$idx] == 'UNIX_TIMESTAMP()') {
// Function UNIX_TIMESTAMP() detected
$SQL .= sprintf("`%s`=UNIX_TIMESTAMP(),", $entry);
// Filter for loading configuration
function FILTER_LOAD_CONFIGURATION ($no = '0') {
+ // Is installation phase?
+ if (isInstallationPhase()) {
+ // Then don't load any configuration
+ return;
+ } // END - if
+
// Is the value null, it comes from the 'init' filter chain
if (is_null($no)) {
$no = '0';