From 4bafa13b5ab21ceca656ca7c834b13a4f3ca8a35 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 2 Jul 2012 20:57:22 +0200 Subject: [PATCH] New: check the real version and remove specific php settings --- build/perl/virtualmin/dolibarr.pl | 46 +++++++++++++++++-------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/build/perl/virtualmin/dolibarr.pl b/build/perl/virtualmin/dolibarr.pl index b6c42c9997a..fe166b8d09c 100644 --- a/build/perl/virtualmin/dolibarr.pl +++ b/build/perl/virtualmin/dolibarr.pl @@ -30,7 +30,7 @@ return "Regis Houssin"; # script_dolibarr_versions() sub script_dolibarr_versions { -return ( "3.3.0", "3.2.0", "3.1.0", "3.0.1", "2.9.0" ); +return ( "3.3.0", "3.2.1", "3.1.1" ); } sub script_dolibarr_category @@ -43,13 +43,6 @@ sub script_dolibarr_php_vers return ( 5 ); } -sub script_dolibarr_php_vars -{ -return ( [ 'memory_limit', '64M', '+' ], - [ 'upload_max_filesize', '10M', '+' ], - [ 'max_execution_time', '60', '+' ] ); -} - sub script_dolibarr_php_modules { local ($d, $ver, $phpver, $opts) = @_; @@ -348,21 +341,32 @@ if ($opts->{'newdb'}) { return (1, "Dolibarr directory and tables deleted."); } -# script_dolibarr_latest(version) -# Returns a URL and regular expression or callback func to get the version -sub script_dolibarr_latest +# script_dolibarr_realversion(&domain, &opts) +# Returns the real version number of some script install, or undef if unknown +sub script_dolibarr_realversion +{ +local ($d, $opts, $sinfo) = @_; +local $lref = &read_file_lines("$opts->{'dir'}/filefunc.inc.php", 1); +foreach my $l (@$lref) { + if ($l =~ /'DOL_VERSION','([0-9a-z\.\-]+)'/) { + return $1; + } + } +return undef; +} + +# script_dolibarr_check_latest(version) +# Checks if some version is the latest for this project, and if not returns +# a newer one. Otherwise returns undef. +sub script_dolibarr_check_latest { local ($ver) = @_; -if ($ver >= 3.0) { - return ( "http://sourceforge.net/projects/dolibarr/files/". - "Dolibarr%20ERP-CRM", - "(3\\.[0-9\\.]+)" ); - } -elsif ($ver >= 2.9) { - return ( "http://www.dolibarr.fr/files/stable/", - "dolibarr\\-(2\\.[0-9\\.]+)" ); - } -return ( ); +local @vers = &osdn_package_versions("dolibarr", + $ver >= 3 ? "dolibarr\\-(3\\.[0-9\\.]+)\\.tgz" : + $ver >= 2.9 ? "dolibarr\\-(2\\.9\\.[0-9\\.]+)\\.tgz" : + "dolibarr\\-(2\\.8\\.[0-9\\.]+)\\.tgz"); +return "Failed to find versions" if (!@vers); +return $ver eq $vers[0] ? undef : $vers[0]; } sub script_dolibarr_site