From cd85c459f76ea708aef48182c898da24b2de3320 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 21 Sep 2022 10:07:02 +0200 Subject: [PATCH] php task: restore compat with very old releases using php5 again 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 --- DAB.pm | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/DAB.pm b/DAB.pm index b4f8a37..f6a6200 100644 --- 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); } }