X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FInstallationCheck.pm;h=0ed1d938456dbe25a5f38cdce51c7063893c808b;hb=89c9ff022d3f13e27ba6bda085df15707fcfb0eb;hp=dc2a124f072a21dbe53f0ffa8046c48cc48f9fb8;hpb=4e3d7a2e64528970fb1927526a289f9b0c76f409;p=kivitendo-erp.git diff --git a/SL/InstallationCheck.pm b/SL/InstallationCheck.pm index dc2a124f0..0ed1d9384 100644 --- a/SL/InstallationCheck.pm +++ b/SL/InstallationCheck.pm @@ -1,31 +1,60 @@ package SL::InstallationCheck; -use vars qw(@required_modules); +use English '-no_match_vars'; +use IO::File; +use vars qw(@required_modules @optional_modules); + +use strict; + +BEGIN { @required_modules = ( - { "name" => "Class::Accessor", "url" => "http://search.cpan.org/~kasei/" }, - { "name" => "CGI", "url" => "http://search.cpan.org/~lds/" }, - { "name" => "CGI::Ajax", "url" => "http://search.cpan.org/~bct/" }, - { "name" => "DBI", "url" => "http://search.cpan.org/~timb/" }, - { "name" => "DBD::Pg", "url" => "http://search.cpan.org/~dbdpg/" }, - { "name" => "HTML::Template", "url" => "http://search.cpan.org/~samtregar/" }, - { "name" => "Archive::Zip", "url" => "http://search.cpan.org/~adamk/" }, - { "name" => "Text::Iconv", "url" => "http://search.cpan.org/~mpiotr/" }, - { "name" => "Time::HiRes", "url" => "http://search.cpan.org/~jhi/" }, - { "name" => "YAML", "url" => "http://search.cpan.org/~ingy/" }, - { "name" => "IO::Wrap", "url" => "http://search.cpan.org/~dskoll/" }, - { "name" => "Text::CSV_XS", "url" => "http://search.cpan.org/~hmbrand/" }, - { "name" => "List::Util", "url" => "http://search.cpan.org/~gbarr/" }, - ); + { name => "parent", url => "http://search.cpan.org/~corion/", debian => 'libparent-perl' }, + { name => "Archive::Zip", version => '1.16', url => "http://search.cpan.org/~adamk/", debian => 'libarchive-zip-perl' }, + { name => "Class::Accessor", version => '0.30', url => "http://search.cpan.org/~kasei/", debian => 'libclass-accessor-perl' }, + { name => "CGI::Ajax", version => '0.697', url => "http://search.cpan.org/~bct/" }, # no debian package, ours contains bugfixes + { name => "DateTime", url => "http://search.cpan.org/~drolsky/", debian => 'libdatetime-perl' }, + { name => "DBI", version => '1.50', url => "http://search.cpan.org/~timb/", debian => 'libdbi-perl' }, + { name => "DBD::Pg", version => '1.49', url => "http://search.cpan.org/~dbdpg/", debian => 'libdbd-pg' }, + { name => "Email::Address", url => "http://search.cpan.org/~rjbs/", debian => 'libemail-address-perl' }, + { name => "FCGI", url => "http://search.cpan.org/~mstrout/", debian => 'libfcgi-perl' }, + { name => "List::MoreUtils", version => '0.21', url => "http://search.cpan.org/~vparseval/", debian => 'liblist-moreutils-perl' }, + { name => "PDF::API2", version => '2.000', url => "http://search.cpan.org/~areibens/", debian => 'libpdf-api2-perl' }, + { name => "Rose::Object", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-object-perl' }, + { name => "Rose::DB", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-db-perl' }, + { name => "Rose::DB::Object", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-db-object-perl' }, + { name => "Sort::Naturally", url => "http://search.cpan.org/~sburke/", debian => 'libsort-naturally-perl' }, + { name => "Template", version => '2.18', url => "http://search.cpan.org/~abw/", debian => 'libtemplate-perl' }, + { name => "Text::CSV_XS", version => '0.23', url => "http://search.cpan.org/~hmbrand/", debian => 'libtext-csv-xs-perl' }, + { name => "Text::Iconv", version => '1.2', url => "http://search.cpan.org/~mpiotr/", debian => 'libtext-iconv-perl' }, + { name => "URI", version => '1.35', url => "http://search.cpan.org/~gaas/", debian => 'liburi-perl' }, + { name => "XML::Writer", version => '0.602', url => "http://search.cpan.org/~josephw/", debian => 'libxml-writer-perl' }, + { name => "YAML", version => '0.62', url => "http://search.cpan.org/~ingy/", debian => 'libyaml-perl' }, +); + +@optional_modules = (); + +$_->{fullname} = join ' ', grep $_, @$_{qw(name version)} + for @required_modules, @optional_modules; +} sub module_available { - my ($module) = @_; + my $module = $_[0]; + my $version = $_[1] || '' ; + + return eval "use $module $version; 1"; +} + +my %conditional_dependencies; + +sub check_for_conditional_dependencies { + return if $conditional_dependencies{net_ldap}++; + + my $self = {}; + eval do { local (@ARGV, $/) = 'config/authentication.pl'; <> } or return; - if (!defined(eval("require $module;"))) { - return 0; - } else { - return 1; - } + push @required_modules, { 'name' => 'Net::LDAP', 'url' => 'http://search.cpan.org/~gbarr/' } + if $self->{module} && ($self->{module} eq 'LDAP'); } sub test_all_modules {