Commit 21537b2e authored by Jonathon Duerig's avatar Jonathon Duerig

Fix to sitevarsdiff so it parses the new ns_include column in sitevariables correctly.

parent e99967cd
......@@ -79,6 +79,9 @@ foreach my $i (keys %sitevars) {
if ($sitevars1{$i}{"desc"} ne $sitevars2{$i}{"desc"}) {
push @setClause, "description=" . $sitevars2{$i}{"desc"};
}
if ($sitevars1{$i}{"ns_include"} ne $sitevars2{$i}{"ns_include"}) {
push @setClause, "ns_include=" . $sitevars2{$i}{"ns_include"};
}
if (@setClause) {
$diff++;
if (!$quiet) { print "# sitevar $i was changed.\n"; }
......@@ -103,7 +106,8 @@ foreach my $i (keys %sitevars) {
"$i,".
"NULL" . ",".
$sitevars2{$i}{"dval"} . ",".
$sitevars2{$i}{"desc"} .
$sitevars2{$i}{"desc"} . ",".
$sitevars2{$i}{"ns_include"} .
");\n\n";
}
}
......@@ -130,7 +134,7 @@ sub read_sitevars($$) {
open(FH,"<$filename") or die "Unable to open $filename: $!\n";
while(<FH>) {
my ($name, $val, $dval, $desc);
my ($name, $val, $dval, $desc, $ns_include);
if (/^INSERT( IGNORE)? INTO `?sitevariables`?/) {
#
......@@ -141,19 +145,29 @@ sub read_sitevars($$) {
# followed by a closed quote.
#
my $match = "^(('([^\\']|(\\\\.))*')|(NULL))";
#
# Either match NULL, or
# a nonempty sequence of digits
#
my $matchint = "^(([0-9]+)|(NULL))";
s/^INSERT( IGNORE)? INTO `?sitevariables`? VALUES \(//;
($name) = /${match},/;
s/${match},// or die "bad parse $_";
s/${match},// or die "bad name parse $_";
($val) = /${match},/;
s/${match},// or die "bad parse $_";
s/${match},// or die "bad val parse $_";
($dval) = /${match},/;
s/${match},// or die "bad parse $_";
($desc) = /${match}\);/;
s/${match}\);// or die "bad parse $_";
s/${match},// or die "bad dval parse $_";
($desc) = /${match},/;
s/${match},// or die "bad desc parse $_";
($ns_include) = /${matchint}\);/;
s/${matchint}\);// or die "bad ns_include parse $_";
debug("Adding variable $name...\n");
${$hashref}{$name}{"dval"} = $dval;
${$hashref}{$name}{"desc"} = $desc;
${$hashref}{$name}{"ns_include"} = $ns_include;
}
}
......
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