lib/TWiki/Configure/Checkers/UseClientSessions.pm
changeset 0 414e01d06fd5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/TWiki/Configure/Checkers/UseClientSessions.pm	Sat Jan 26 15:50:53 2008 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +#
     1.5 +# TWiki Enterprise Collaboration Platform, http://TWiki.org/
     1.6 +#
     1.7 +# Copyright (C) 2000-2006 TWiki Contributors.
     1.8 +#
     1.9 +# This program is free software; you can redistribute it and/or
    1.10 +# modify it under the terms of the GNU General Public License
    1.11 +# as published by the Free Software Foundation; either version 2
    1.12 +# of the License, or (at your option) any later version. For
    1.13 +# more details read LICENSE in the root of this distribution.
    1.14 +#
    1.15 +# This program is distributed in the hope that it will be useful,
    1.16 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.17 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    1.18 +#
    1.19 +# As per the GPL, removal of this notice is prohibited.
    1.20 +package TWiki::Configure::Checkers::UseClientSessions;
    1.21 +
    1.22 +use strict;
    1.23 +
    1.24 +use TWiki::Configure::Checker;
    1.25 +
    1.26 +use base 'TWiki::Configure::Checker';
    1.27 +
    1.28 +my @modules = (
    1.29 +    {
    1.30 +        name => 'CGI::Session',
    1.31 +        usage => "Sessions",
    1.32 +        requiredVersion => 1,
    1.33 +    },
    1.34 +    {
    1.35 +        name => 'CGI::Cookie',
    1.36 +        usage => "Sessions",
    1.37 +        recommendedVersion => 1,
    1.38 +    },
    1.39 +   );
    1.40 +
    1.41 +sub check {
    1.42 +    my $this = shift;
    1.43 +
    1.44 +    my $mess = '';
    1.45 +    if (!eval "use CGI::Cookie; 1") {
    1.46 +        $mess .= <<HERE;
    1.47 +The CGI::Cookie Perl module is required for session support, but is not
    1.48 +available.
    1.49 +HERE
    1.50 +    }
    1.51 +    if (!eval "use CGI::Session; 1") {
    1.52 +        $mess .= <<HERE;
    1.53 +The CGI::Session Perl module is required for session support, but is not
    1.54 +available.
    1.55 +HERE
    1.56 +    }
    1.57 +    if( $mess ) {
    1.58 +        if ($TWiki::cfg{UseClientSessions} ) {
    1.59 +            $mess = $this->ERROR( $mess );
    1.60 +        } else {
    1.61 +            $mess = $this->WARN( $mess );
    1.62 +        }
    1.63 +    }
    1.64 +    return $mess;
    1.65 +}
    1.66 +
    1.67 +1;