Commit 406b5e23 authored by Robert Ricci's avatar Robert Ricci

Merge branch 'sitevar-into-ns'

parents 931d868d 94c7d4f7
......@@ -3133,6 +3133,7 @@ CREATE TABLE `sitevariables` (
`value` text,
`defaultvalue` text NOT NULL,
`description` text,
`ns_include` tinyint(0) NOT NULL default 0,
PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
#
# Add a new column to the sitevariables table
#
if (!DBSlotExists("sitevariables", "ns_include")) {
DBQueryFatal("alter table sitevariables add column ns_include " .
"tinyint(0) NOT NULL default 0");
return 0;
}
}
1;
......@@ -566,6 +566,28 @@ sub GenDefsFile($)
}
print TCL "\n";
print TCL "# Site variables\n";
$query_result = DBQueryFatal("select name,value,defaultvalue " .
" from sitevariables where ns_include=TRUE");
while (my ($name,$value,$defaultvalue) = $query_result->fetchrow_array()) {
# Use the default value if unset, or skip altogether if the default
# is just the empty string.
if (!defined($value)) {
if ($defaultvalue eq "") {
next;
} else {
$value = $defaultvalue;
}
}
# Escape special characters in the value (just braces)
$value =~ s/([{}])/\\$1/g;
# Note: braces in tcl act like single quotes in other scripting
# languages (eg. no interpolation occurs)
print TCL "set sitevariables($name) {$value}\n";
}
print TCL "\n";
if (defined($pid)) {
print TCL "# OSIDs\n";
$query_result =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment