#!/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: 1351 $ # @author $Author: jtietz $ # @lastmodified $Date: 2011-01-16 20:55:42 +0100 (So, 16. Jan 2011) $ # @filesource $URL: https://mysqldumper.svn.sourceforge.net/svnroot/mysqldumper/branches/msd1.24.3/msd_cron/perltest.pl $ use strict; use Socket; use Config; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use CGI; warningsToBrowser(1); # dies ist ganz wichtig! 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_ftpssl=0; my $dbi_driver; my $dbi_mysql_exists=0; my $get_options=0; my $ok=''; my $err=''; my $zlib_version='unknown'; my $cgi = CGI->new(); 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

\n"; print "

Necessary Modules for crondump.pl

"; print "testing DBI ...\n"; eval { $eval_in_died = 1; require DBI; }; if(!$@){ $mod_dbi = 1; import DBI; } 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. 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; } if($mod_ff!=1){ print $err."Critical error: modul File::Find not found! Please install it
\n"; } else { print $ok."Found modul File::Find. OK.
\n"; } print "testing File::Basename ...\n"; eval { $eval_in_died = 1; require File::Basename; }; if(!$@){ $mod_fb = 1; import File::Basename; } if($mod_fb!=1){ print $err."Critical error: modul File::Basename not found! Please install it!
\n"; } else { print $ok."Found modul File::Basename. OK.
\n"; } print "testing Getop...\n"; eval { $eval_in_died = 1; require Getopt::Long; }; if(!$@){ $get_options = 1; import Getopt::Long; } 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. 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(!$@){ $zlib_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 ".$zlib_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; } 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. 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; } 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. 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; } 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. OK. crondump.pl can send emails.
\n"; } print "



\n";