]> git.proxmox.com Git - dab.git/commitdiff
php task: restore compat with very old releases using php5 again
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Sep 2022 08:07:02 +0000 (10:07 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Sep 2022 08:09:50 +0000 (10:09 +0200)
note that both, php5 and the affected releases are EOL since years,
but as we do not want to drop the historic releases completely just
yet, restore the task functionality.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
DAB.pm

diff --git a/DAB.pm b/DAB.pm
index b4f8a377033db50d087ff160bf0dc32cafde32de..f6a6200078514201489178c406752b7607ae8942 100644 (file)
--- a/DAB.pm
+++ b/DAB.pm
@@ -1889,15 +1889,35 @@ sub task_php {
 
     my $memlimit = $opts->{memlimit};
     my $rootdir = $self->{rootfs};
+    my $suite = $self->{config}->{suite};
 
-    my $required = $self->compute_required([qw(php php-cli libapache2-mod-php php-gd)]);
+    my $base_set = [qw(php-cli libapache2-mod-php php-gd)];
+    if ($suite =~ /(?:squeeze|wheezy|jessie)$/) {
+       $self->logmsg("WARN: using EOL php release on EOL suite");
+       $base_set = [qw(php5 php5-cli libapache2-mod-php5 php5-gd)];
+    }
+    my $required = $self->compute_required($base_set);
 
     $self->cache_packages ($required);
 
     $self->ve_dpkg ('install', @$required);
 
     if ($memlimit) {
-       $self->run_command ("sed -e 's/^\\s*memory_limit\\s*=.*;/memory_limit = ${memlimit}M;/' -i $rootdir/etc/php5/apache2/php.ini");
+       my $sed_cmd = ['sed', '-e', "s/^\\s*memory_limit\\s*=.*;/memory_limit = ${memlimit}M;/", '-i'];
+       if ($suite =~ /(?:squeeze|wheezy|jessie)$/) {
+           push @$sed_cmd, "$rootdir/etc/php5/apache2/php.ini";
+       } else {
+           my $found = 0;
+           for my $fn (glob("'${rootdir}/etc/php/*/apache2/php.ini'")) {
+               push @$sed_cmd, "$rootdir/$fn";
+               $found = 1;
+           }
+           if (!$found) {
+               warn "WARN: did not found any php.ini to set the memlimit!\n";
+               return;
+           }
+       }
+       $self->run_command($sed_cmd);
     }
 }