#!/usr/bin/perl -w
# This file is part of MySQLDumper released under the GNU/GPL 2 license
# http://www.mysqldumper.net
# @package MySQLDumper
# @version $Rev$
# @author $Author$
# @lastmodified $Date$
# @filesource $URL$
use strict;
use Socket;
use Config;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use CGI;
warningsToBrowser(1);
my $eval_in_died;
my $mod_dbi=0;
my $mod_ff=0;
my $mod_fb=0;
my $mod_gz=0;
my $mod_ftp=0;
my $mod_mime=0;
my $mod_auth=0;
my $mod_base64=0;
my $mod_ssl=0;
my $mod_ftpssl=0;
my $dbi_driver;
my $dbi_mysql_exists=0;
my $get_options=0;
my $ok='';
my $err='';
my $mod_version='unknown';
my $pversion ;
if ($^V){
$pversion = sprintf "v%vd", $^V ; # v5.10.1
}else{
$pversion = local $];
}
my $cgi = new CGI;
print $cgi->header(-type => 'text/html; charset=utf-8', -cache_control => 'no-cache, no-store, must-revalidate');
print "\n";
print "MySQLDumper Perl modul test\n";
print '';
print "Testing needed Perl-Moduls in order to run the Perl script crondump.pl (Perl $pversion found)
\n";
print "Necessary Modules for crondump.pl
";
print "testing DBI ...\n";
eval { $eval_in_died = 1; require DBI; };
if(!$@){
$mod_dbi = 1;
import DBI;
$mod_version = $DBI::VERSION;
}
if($mod_dbi!=1){
print $err."
Couldn't find DBI!
crondump.pl can't establish a connection to the MySQL database!\n";
} else {
print $ok."Found modul DBI ".$mod_version.". OK.\n";
my @available_drivers = DBI->available_drivers('quiet');
foreach $dbi_driver (@available_drivers)
{
print "
Found modul DBI::$dbi_driver\n";
if ( $dbi_driver eq 'mysql' ) { $dbi_mysql_exists=1; } ;
}
if ($dbi_mysql_exists !=1 ) { print $err."
Critical error: modul DBI::mysql not found! crondump.pl can't establish a connection to the MySQL-Database if this modul isn't installed! Please install DBI::mysql!"; }
else { print "
".$ok."Found modul DBI::mysql. OK. crondump.pl can connect to MySQL-Database."; }
}
print "
testing File::Find ...\n";
eval { $eval_in_died = 1; require File::Find; };
if(!$@){
$mod_ff = 1;
import File::Find;
$mod_version = $File::Find::VERSION;
}
if($mod_ff!=1){
print $err."Critical error: modul File::Find not found! Please install it
\n";
} else {
print $ok."Found modul File::Find ".$mod_version.". OK.
\n";
}
print "testing File::Basename ...\n";
eval { $eval_in_died = 1; require File::Basename; };
if(!$@){
$mod_fb = 1;
import File::Basename;
$mod_version = $File::Basename::VERSION;
}
if($mod_fb!=1){
print $err."Critical error: modul File::Basename not found! Please install it!
\n";
} else {
print $ok."Found modul File::Basename ".$mod_version.". OK.
\n";
}
print "testing Getop...\n";
eval { $eval_in_died = 1; require Getopt::Long; };
if(!$@){
$get_options = 1;
import Getopt::Long;
$mod_version = $Getopt::Long::VERSION;
}
if($get_options!=1){
print $err."Modul Getopt not found! You should install it if you want to set configfile via shell.
\n";
} else {
print $ok."Found modul Getopt ".$mod_version.". OK. crondump.pl can read configfile-parameter from shell.
\n";
}
print "
Configurable functions for crondump.pl (these moduls are only needed when explained option is turned on):
";
print "testing Compress::Zlib (needed for dumping data into a crompessed *.gz-file)...
\n";
eval { $eval_in_died = 1; require Compress::Zlib; };
if(!$@){
$mod_version=qq[ver $Compress::Zlib::VERSION];
$mod_gz = 1;
import Compress::Zlib;
}
if($mod_gz!=1){
print "Error: modul Compress::Zlib not found! crondump.pl can't write compressed files. Falling back to uncrompressed files (files are 10 times bigger).
\n";
} else {
print $ok."Found modul Compress::Zlib ".$mod_version.". OK. crondump.pl can write compressed backups.
\n";
}
print "
testing Net::FTP (needed if you want to transfer backups to another server)...
\n";
eval { $eval_in_died = 1; require Net::FTP; };
if(!$@){
$mod_ftp = 1;
import Net::FTP;
$mod_version = $Net::FTP::VERSION;
}
if($mod_ftp!=1){
print $err."Error: modul Net::FTP not found! crondump.pl can't transfer data via FTP.
\n";
} else {
print $ok."Found modul Net::FTP ".$mod_version.". OK - crondump.pl can send backups via FTP.
\n";
}
print "
testing Net::FTPSSL (needed if you want to transfer backups to another server with ssl encryption)...
\n";
eval { $eval_in_died = 1; require Net::FTPSSL; };
if(!$@){
$mod_ftpssl = 1;
import Net::FTPSSL;
$mod_version = $Net::FTPSSL::VERSION;
}
if($mod_ftpssl !=1){
print $err."Error: modul Net::FTPSSL not found! crondump.pl can't transfer data via FTP with ssl encryption.
\n";
} else {
print $ok."Found modul Net::FTPSSL ".$mod_version.". OK - crondump.pl can send backups via FTP with ssl encryption.
\n";
}
print "
testing MIME::Lite (needed if you want to send backups via email)...
\n";
eval { $eval_in_died = 1; require MIME::Lite; };
if(!$@){
$mod_mime = 1;
import MIME::Lite;
$mod_version = $MIME::Lite::VERSION;
}
if($mod_mime!=1){
print $err."Error: modul MIME::Lite not found!
crondump.pl can't send emails! Option will automatically be deactivated. Install Mime::Lite in order to send emails!\n";
} else {
print $ok."Found modul MIME::Lite ".$mod_version.". OK. crondump.pl can send emails.
\n";
}
print "
testing Authen::SASL (needed if you want to use SMTP_AUTH for email)...
\n";
eval { $eval_in_died = 1; require Authen::SASL; };
if(!$@){
$mod_auth = 1;
import Authen::SASL;
$mod_version = $Authen::SASL::VERSION;
}
if($mod_auth!=1){
print $err."Error: modul Authen::SASL not found!
crondump.pl can't send emails with SMTP_AUTH. Install Authen::SASL in order to use SMTP_AUTH!\n";
} else {
print $ok."Found modul Authen::SASL ".$mod_version.". OK. crondump.pl can use SMTP_AUTH.
\n";
}
print "
testing MIME::Base64 (needed if you want to use SMTP_AUTH for email)...
\n";
eval { $eval_in_died = 1; require MIME::Base64; };
if(!$@){
$mod_base64 = 1;
import MIME::Base64;
$mod_version = $MIME::Base64::VERSION;
}
if($mod_base64!=1){
print $err."Error: modul MIME::Base64 not found!
crondump.pl can't send emails with SMTP_AUTH! Option will automatically be deactivated. Install Mime::Base64 in order to use SMTP_AUTH!\n";
} else {
print $ok."Found modul MIME::Base64 ".$mod_version.". OK. crondump.pl can encode user/pass for SMTP_AUTH.
\n";
}
print "
testing Net::SMTP::SSL (needed if you want to send email with ssl encryption)...
\n";
eval { $eval_in_died = 1; require Net::SMTP::SSL; };
if(!$@){
$mod_ssl = 1;
import Net::SMTP::SSL;
$mod_version = $Net::SMTP::SSL::VERSION;
}
if($mod_ssl !=1){
print $err."Error: modul Net::SMTP::SSL not found!
crondump.pl can't send emails with ssl! Option will automatically be deactivated. Install Net::SMTP::SSL in order to use SSL!\n";
} else {
print $ok."Found modul Net::SMTP::SSL ".$mod_version.". OK. crondump.pl can send emails with ssl.
\n";
}
print "
\n";