Skip to content

Commit

Permalink
Item11386: Add a sanity check for the Query settings
Browse files Browse the repository at this point in the history
Note:  This does not need to be pulled into Foswiki trunk - 1.2 uses an
alternate way of detecting the query operators.  This issue can probably
only happen if a 1.0 system has been upgraded to 1.1.

Also, a checker won't work here because the setting is Hidden, and the
checkers are not executed for hidden settings.

git-svn-id: http://svn.foswiki.org/branches/Release01x01@13512 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Dec 26, 2011
1 parent 07fc763 commit 6b64e63
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions core/lib/Foswiki/Configure/Checkers/BasicSanity.pm
Expand Up @@ -178,6 +178,30 @@ HERE
$ENV{PATH} = $Foswiki::cfg{SafeEnvPath};
delete @ENV{qw( IFS CDPATH ENV BASH_ENV )};

# The following check for OP_match is only needed on Foswiki 1.1.
# Foswiki 1.2 does not use this setting.
my $goodOp = 0;
foreach my $op ( @{$Foswiki::cfg{Operators}{Query}} ) {
if ( $op eq 'Foswiki::Query::OP_match' ) {
$goodOp = 1;
last;
}
}

unless ( $goodOp ) {
$result .= $this->ERROR(<<'MESSAGE');
<code>lib/LocalSite.cfg</code> has a problem. The setting for
<code>{Operators}{Query}</code> is missing the definition for the match operator.
Was the configuration upgraded from Foswiki 1.0.x? Please remove <code>lib/LocalSite.cfg</code>
and reconfigure, or edit the file and manually add the <code>OP_match</code> definition as shown here:
<pre>$Foswiki::cfg{Operators}{Query} = [
'Foswiki::Query::OP_match',
'Foswiki::Query::OP_and',
... (list continues)
</pre>
MESSAGE
}

return $result;
}

Expand Down

0 comments on commit 6b64e63

Please sign in to comment.