/[smeserver]/rpms/smeserver-php/sme10/smeserver-php-3.0.0-bz11401-empty-property-not-honored.patch
ViewVC logotype

Annotation of /rpms/smeserver-php/sme10/smeserver-php-3.0.0-bz11401-empty-property-not-honored.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Mon Mar 8 06:32:27 2021 UTC (3 years, 7 months ago) by jpp
Branch: MAIN
CVS Tags: smeserver-php-3_0_0-44_el7_sme, smeserver-php-3_0_0-47_el7_sme, smeserver-php-3_0_0-31_el7_sme, smeserver-php-3_0_0-28_el7_sme, smeserver-php-3_0_0-45_el7_sme, smeserver-php-3_0_0-48_el7_sme, smeserver-php-3_0_0-43_el7_sme, smeserver-php-3_0_0-46_el7_sme, smeserver-php-3_0_0-41_el7_sme, smeserver-php-3_0_0-30_el7_sme, smeserver-php-3_0_0-29_el7_sme, smeserver-php-3_0_0-42_el7_sme, smeserver-php-3_0_0-34_el7_sme, smeserver-php-3_0_0-37_el7_sme, smeserver-php-3_0_0-40_el7_sme, smeserver-php-3_0_0-35_el7_sme, smeserver-php-3_0_0-32_el7_sme, smeserver-php-3_0_0-38_el7_sme, smeserver-php-3_0_0-27_el7_sme, smeserver-php-3_0_0-39_el7_sme, smeserver-php-3_0_0-36_el7_sme, smeserver-php-3_0_0-33_el7_sme, HEAD
* Mon Mar 08 2021 Jean-Philipe Pialasse <tests@pialasse.com> 3.0.0-27.sme
- String not honoured as php-fpm but as default [SME: 11401]

1 jpp 1.1 diff -Nur --no-dereference smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/20LoadModule80PHP smeserver-php-3.0.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/20LoadModule80PHP
2     --- smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/20LoadModule80PHP 2021-03-07 15:11:54.624000000 -0500
3     +++ smeserver-php-3.0.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/20LoadModule80PHP 2021-03-08 01:04:26.910000000 -0500
4     @@ -3,8 +3,8 @@
5     # default we return with nothing activated
6     return "#PHP mod is disabled by default, please use PHP-fpm" unless (exists $php{status} and $php{status} eq "enabled" and $phpModule eq "enabled");
7    
8     - $PHPVersion = $php{'PHPVersion'} ||'73';
9     - ($PHPVersion) = $PHPVersion =~ /([0-9]{2})/;
10     + use esmith::php;
11     + our $PHPVersion = PHPdefault(1);
12     my $phpMR = substr($PHPVersion,0,1) || '';
13     #php7 software collection libphp72.so
14     return "LoadModule php$\{phpMR\}_module modules/libphp$PHPVersion.so\n" if (-r "/usr/lib64/httpd/modules/libphp$PHPVersion.so");
15     diff -Nur --no-dereference smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/20LoadModule81FastCGI smeserver-php-3.0.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/20LoadModule81FastCGI
16     --- smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/20LoadModule81FastCGI 2020-01-28 13:50:45.000000000 -0500
17     +++ smeserver-php-3.0.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/20LoadModule81FastCGI 2021-03-08 01:04:07.503000000 -0500
18     @@ -1,6 +1,4 @@
19     {
20     -$PHPVersion = $php{'PHPVersion'} ||'73';
21     -my ($PHPVersion) = $PHPVersion =~ /([0-9]{2})/;
22     $fastcgi_mod = 'mod_proxy_fcgi';
23     $OUT .=<<_EOF;
24     LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
25     diff -Nur --no-dereference smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays smeserver-php-3.0.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays
26     --- smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays 2021-03-07 15:11:54.710000000 -0500
27     +++ smeserver-php-3.0.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays 2021-03-08 01:04:47.612000000 -0500
28     @@ -14,8 +14,7 @@
29     # configuration to enable php-fpm for the ibay
30     if ($fastcgi_mod eq 'mod_proxy_fcgi')
31     {
32     - my $version = $ibay->prop('PHPVersion') || $PHPVersion || '73';
33     - ($version) = $version =~ /([0-9]{2})/ unless $version eq '';
34     + my $version = PhpFpmVersionToUse($ibay);
35     my $name = lc $key;
36     $OUT .=<<"_EOF";
37     SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=\$1
38     diff -Nur --no-dereference smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/php-fpm.d/ibays.conf/10Ibays smeserver-php-3.0.0/root/etc/e-smith/templates/etc/php-fpm.d/ibays.conf/10Ibays
39     --- smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/php-fpm.d/ibays.conf/10Ibays 2021-03-07 15:11:54.736000000 -0500
40     +++ smeserver-php-3.0.0/root/etc/e-smith/templates/etc/php-fpm.d/ibays.conf/10Ibays 2021-03-08 01:06:11.720000000 -0500
41     @@ -1,12 +1,11 @@
42     {
43    
44     use esmith::AccountsDB;
45     +use esmith::php;
46     my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database";
47    
48     foreach my $ibay ($a->get_all_by_prop(type => 'ibay')){
49     - my $PHPVersion = $php{'PHPVersion'} ||'73';
50     - ($PHPVersion) = $PHPVersion =~ /([0-9]{2})/;
51     - my $version = $ibay->prop('PHPVersion') || $PHPVersion || '73';
52     + my $version = PhpFpmVersionToUse($ibay);
53     my $dynamic = $ibay->prop('CgiBin') || 'disabled';
54     my $custom = $ibay->prop('PHPCustomPool') || undef;
55     next unless ($dynamic eq 'enabled' && $version eq $PHP_VERSION && !$custom);
56     diff -Nur --no-dereference smeserver-php-3.0.0.old/root/usr/share/perl5/vendor_perl/esmith/php.pm smeserver-php-3.0.0/root/usr/share/perl5/vendor_perl/esmith/php.pm
57     --- smeserver-php-3.0.0.old/root/usr/share/perl5/vendor_perl/esmith/php.pm 2021-03-07 15:11:54.741000000 -0500
58     +++ smeserver-php-3.0.0/root/usr/share/perl5/vendor_perl/esmith/php.pm 2021-03-08 01:26:46.184000000 -0500
59     @@ -4,8 +4,11 @@
60     use warnings;
61     use esmith::ConfigDB;
62    
63     +our $PHPDEFAULT = 74;
64     +our $BASEPHP = 54;
65     +
66     our @ISA = qw(Exporter);
67     -our @EXPORT = qw( listPHPVersionFPM listPHPVersionShort listPHPVersionHash listPHPVersionHashShort);
68     +our @EXPORT = qw( listPHPVersionFPM listPHPVersionShort listPHPVersionHash listPHPVersionHashShort PHPdefault VersionToUse PhpFpmVersionToUse);
69    
70     =head1 NAME
71    
72     @@ -58,7 +61,8 @@
73     }
74    
75     =head2 listPHPVersionShort
76     -param = (enabled, disabled, all) , if empty default to all
77     +param1 = (enabled, disabled, all) , if empty default to all
78     +param2 = will use "" as output for base php
79    
80     this will return you an array of numerical available php version
81     print "'$_'\n" for listPHPVersionShort('all');
82     @@ -77,15 +81,17 @@
83     =cut
84     sub listPHPVersionShort {
85     my $status = shift || 'all';
86     + my $emptyforbase = shift;
87     my @FPM = listPHPVersionFPM($status);
88     s/^php([0-9]{2})-php-fpm$/$1/ for @FPM ;
89     - s/^php-fpm$/54/ for @FPM ;
90     + my $base= (defined $emptyforbase) ? "" : $BASEPHP;
91     + s/^php-fpm$/$base/ for @FPM ;
92     return @FPM;
93     }
94    
95     =head2 listPHPVersionHash
96     -param = (enabled, disabled, all) , if empty default to all
97     -
98     +param1 = (enabled, disabled, all) , if empty default to all
99     +param2 = if defined will use "" as key for php-fpm
100     this will return you a hash order by version
101     my %list= listPHPVersionHash();
102     print "$_ => $list{$_}\n" for (sort keys %list);
103     @@ -101,17 +107,20 @@
104     =cut
105     sub listPHPVersionHash {
106     my $status = shift || 'all';
107     + my $emptyforbase = shift;
108     my @FPM = listPHPVersionFPM($status);
109     my %myfpm;
110     + my $base= (defined $emptyforbase) ? "" : $BASEPHP;
111     for my $php ( @FPM) {
112     - $myfpm{"54"}="$php" for ( $php=~/^php-fpm$/);
113     + $myfpm{$base}="$php" for ( $php=~/^php-fpm$/);
114     $myfpm{$_}="$php" for ( $php=~/^php([0-9]{2})-php-fpm$/);
115     }
116     return %myfpm;
117     }
118    
119     =head2 listPHPVersionHashShort
120     -param = (enabled, disabled, all) , if empty default to all
121     +param1 = (enabled, disabled, all) , if empty default to all
122     +param2 = if defined will use "" as key for php-fpm
123    
124     this will return you a hash order by version
125     my %list= listPHPVersionHashShort();
126     @@ -128,11 +137,94 @@
127     =cut
128     sub listPHPVersionHashShort {
129     my $status = shift || 'all';
130     - my %myfpm = listPHPVersionHash($status);
131     + my $emptyforbase = shift;
132     + my %myfpm = listPHPVersionHash($status, $emptyforbase);
133     my %rfpm;
134     foreach my $key (keys %myfpm) {
135     my $php = $myfpm{$key};
136     - ($rfpm{$key}= $php)=~s/(php[0-9]{0,2}).*/$1/;
137     + ($rfpm{$key}= $php)=~s/(^php[0-9]{0,2}).*/$1/;
138     }
139     return %rfpm;
140     }
141     +
142     +=head2 PHPdefault
143     + return the php default version for the system, i.e. default chosen by rpm or the one overrided by the admin in php PHPVersion property.
144     + one optional argument is to display 54 as empty string (i.e. base php-fpm)
145     +
146     +=cut
147     +sub PHPdefault {
148     + my $emptyforbase = shift;
149     + my $conf = esmith::ConfigDB->open_ro or die "Could not open accounts db";
150     + my $php = $conf->get('php') ;
151     + my $PHPVersion = ( defined $php->prop('PHPVersion') ) ? $php->prop('PHPVersion') : $PHPDEFAULT;
152     + $PHPVersion = ($PHPVersion eq "") ? $BASEPHP : $PHPVersion;
153     + $PHPVersion = ($PHPVersion =~ /([0-9]{2})/) ? $1 : $PHPDEFAULT;
154     + return $PHPVersion unless defined $emptyforbase;
155     + $PHPVersion = ( $PHPVersion eq $BASEPHP ) ? "" : $PHPVersion;
156     + return $PHPVersion;
157     +}
158     +
159     +=head2 VersionToUse
160     +argument 1 : output from $account->get('ibayname') or similar (shares,custom)
161     + it is expected to find in this entry a property PHPVersion
162     +artgument 2 : optional, a locally forced PHP version, if you do not want to trust globally prefered one.
163     +
164     +output : a two digit php version : 74 for php 7.4 . 54 will be for php-fpm 5.4 as default php on CentOS 7 /SME 9
165     +
166     + my $ibay=$account->get('ibayname');
167     + my $version = VersionToUse($ibay,'80');
168     +
169     +logic:
170     +# if not defined => $PHPDEFAULT
171     +# if defined and empty strin => $BASEPHP
172     +# if defined and not empty => its value
173     +
174     +# defined entry (e.g. ibay) PHPVersion property override
175     + - defined forced PHPVersion provided (2nd argument, if provided) which override
176     + - php PHPVersion property which override
177     + - default $PHPDEFAULT
178     +
179     +=cut
180     +sub VersionToUse {
181     + my $entry = shift or return "need a db entry";
182     + my $conf = esmith::ConfigDB->open_ro or die "Could not open accounts db";
183     +
184     + my $PHPVersion = PHPdefault();
185     +
186     + my $forcedefault = shift ;
187     + $forcedefault = ( defined $forcedefault ) ? $forcedefault : $PHPVersion;
188     + $forcedefault = ($forcedefault eq "") ? $BASEPHP : $forcedefault;
189     + $forcedefault = ($forcedefault =~ /([0-9]{2})/) ? $1 : $PHPVersion;
190     +
191     + my $entryPHPVersion = (defined $entry->prop('PHPVersion') ) ? $entry->prop('PHPVersion') : $forcedefault;
192     + $entryPHPVersion = ($entryPHPVersion eq "") ? $BASEPHP : $entryPHPVersion;
193     + $entryPHPVersion = ($entryPHPVersion =~ /([0-9]{2})/) ? $1 : $forcedefault;
194     +
195     + # we currently assume that it is installed and enabled, but could test it here
196     +
197     + my $version= $entryPHPVersion ;
198     + #$version = " $PHPDEFAULT - $PHPVersion - $forcedefault - $entryPHPVersion";
199     +
200     + return $version;
201     +}
202     +
203     +=head2 PhpFpmVersionToUse
204     +same as VersionToUse except it will return null string in place of $BASEPHP (i.e. "" in place of 54)
205     +
206     +argument 1 : output from $account->get('ibayname') or similar (shares,custom)
207     + it is expected to find in this entry a property PHPVersion
208     +artgument 2 : optional, a locally forced PHP version, if you do not want to trust globally prefered one.
209     +
210     +output : a two digit php version : 74 for php 7.4 or empty string, as '' will take place of 54 for php-fpm 5.4 as default php on CentOS 7 /SME 9
211     +
212     +=cut
213     +sub PhpFpmVersionToUse {
214     + #my $entry = shift or return "need a db entry";
215     + #my $forcedefault = shift ;
216     + my $version ;
217     + $version = VersionToUse(@_) ;#$entry,$forcedefault);# if defined $forcedefault;
218     + #$version = VersionToUse($entry) unless defined $forcedefault;
219     + # here we convert $BASEPHP to empty string
220     + $version = ( $version eq $BASEPHP ) ? "" : $version;
221     + return $version;
222     +}

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed