#!/usr/bin/perl -w # Copyright 2001-2003 Six Apart. This code cannot be redistributed without # permission from www.movabletype.org. # # $Id: mt-check.cgi,v 1.24 2003/02/12 01:05:31 btrott Exp $ use strict; local $|=1; my($MT_DIR); BEGIN { if ($0 =~ m!(.*[/\\])!) { $MT_DIR = $1; } else { $MT_DIR = './'; } unshift @INC, $MT_DIR . 'lib'; unshift @INC, $MT_DIR . 'extlib'; } print "Content-Type: text/html\n\n"; print "
\n";

my $is_good = 1;

my @REQ = (
    [ 'HTML::Template', 2, 1, 'HTML::Template is required for all Movable Type application functionality.' ],

    [ 'Image::Size', 0, 1, 'Image::Size is required for file uploads (to determine the size of uploaded images in many different formats).' ],

    [ 'File::Spec', 0.8, 1, 'File::Spec is required for path manipulation across operating systems.' ],

    [ 'CGI::Cookie', 0, 1, 'CGI::Cookie is required for cookie authentication.' ],
);

my @DATA = (
    [ 'DB_File', 0, 0, 'DB_File is required if you want to use the Berkeley DB/DB_File backend.' ],

    [ 'DBD::mysql', 0, 0, 'DBI and DBD::mysql are required if you want to use the MySQL database backend.' ],

    [ 'DBD::Pg', 0, 0, 'DBI and DBD::Pg are required if you want to use the PostgreSQL database backend.' ],

    [ 'DBD::SQLite', 0, 0, 'DBI and DBD::SQLite are required if you want to use the SQLite database backend.' ],
);

my @OPT = (
    [ 'LWP::UserAgent', 0, 0, 'LWP::UserAgent is optional; it is needed if you wish to use the TrackBack system, the weblogs.com ping, or the MT Recently Updated ping.' ],

    [ 'SOAP::Lite', 0.50, 0, 'SOAP::Lite is optional; it is needed if you wish to use the MT XML-RPC server implementation.' ],

    [ 'File::Temp', 0, 0, 'File::Temp is optional; it is needed if you would like to be able to overwrite existing files when you upload.' ],

    [ 'Image::Magick', 0, 0, 'Image::Magick is optional; it is needed if you would like to be able to create thumbnails of uploaded images.' ],
);

print <$TMP")) {
    print "(Probably) Running under cgiwrap or suexec\n";
    unlink($TMP);
}

print "\n";

exit if $ENV{QUERY_STRING} && $ENV{QUERY_STRING} eq 'sys-check';

use Text::Wrap;
$Text::Wrap::columns = 72;

for my $list (\@REQ, \@DATA, \@OPT) {
    my $data = 1 if $list == \@DATA;
    my $req = 1 if $list == \@REQ;
    printf "CHECKING FOR %s MODULES:\n\n", $req ? "REQUIRED" :
        $data ? "DATA STORAGE" : "OPTIONAL";
    if (!$req && !$data) {
        print <VERSION ]}).\n\n";
            $got_one_data = 1 if $data;
        }
    }
    $is_good &= $got_one_data if $data;
    print "\n";
}

if ($is_good) {
    print <\n";