1 |
jpp |
1.1 |
diff -Nur smeserver-php-3.0.0.old/root/etc/e-smith/events/actions/php-pool-customs smeserver-php-3.0.0/root/etc/e-smith/events/actions/php-pool-customs |
2 |
|
|
--- smeserver-php-3.0.0.old/root/etc/e-smith/events/actions/php-pool-customs 2021-02-21 00:19:19.175000000 -0500 |
3 |
|
|
+++ smeserver-php-3.0.0/root/etc/e-smith/events/actions/php-pool-customs 2021-02-21 00:22:17.981000000 -0500 |
4 |
|
|
@@ -4,6 +4,7 @@ |
5 |
|
|
use warnings; |
6 |
|
|
use File::Path qw(make_path remove_tree); |
7 |
|
|
use esmith::ConfigDB; |
8 |
|
|
+use esmith::util; |
9 |
|
|
|
10 |
|
|
my $pool_db = esmith::ConfigDB->open_ro('php') || esmith::ConfigDB->create('php'); |
11 |
|
|
|
12 |
|
|
@@ -16,9 +17,12 @@ |
13 |
|
|
"/var/lib/php/$key/wsdlcache", |
14 |
|
|
"/var/lib/php/$key/opcache", |
15 |
|
|
"/var/lib/php/$key/tmp" ); |
16 |
|
|
- make_path( @dirs, { |
17 |
|
|
- owner => 'root', |
18 |
|
|
- group => 'www' |
19 |
|
|
- }); |
20 |
|
|
+ for (@dirs){ |
21 |
|
|
+ esmith::util::chownFile("root", "www", $_) if -e $_; |
22 |
|
|
+ make_path( $_, { |
23 |
|
|
+ owner => 'root', |
24 |
|
|
+ group => 'www' |
25 |
|
|
+ }) unless -e $_; |
26 |
|
|
+ } |
27 |
|
|
chmod 0770, @dirs; |
28 |
|
|
} |
29 |
|
|
diff -Nur smeserver-php-3.0.0.old/root/etc/e-smith/events/actions/php-pool-dirs smeserver-php-3.0.0/root/etc/e-smith/events/actions/php-pool-dirs |
30 |
|
|
--- smeserver-php-3.0.0.old/root/etc/e-smith/events/actions/php-pool-dirs 2021-02-21 00:19:19.321000000 -0500 |
31 |
|
|
+++ smeserver-php-3.0.0/root/etc/e-smith/events/actions/php-pool-dirs 2021-02-21 00:21:57.740000000 -0500 |
32 |
|
|
@@ -4,39 +4,49 @@ |
33 |
|
|
use warnings; |
34 |
|
|
use esmith::AccountsDB; |
35 |
|
|
use File::Path qw(make_path remove_tree); |
36 |
|
|
+use esmith::util; |
37 |
|
|
|
38 |
|
|
my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database\n"; |
39 |
|
|
|
40 |
|
|
my $event = shift; |
41 |
|
|
-my $pool = shift; |
42 |
|
|
+my $apool = shift; |
43 |
|
|
|
44 |
|
|
-die "Missing pool name argument" unless $pool; |
45 |
|
|
+my @pools = (defined $apool && $a->get($apool) ) ? map { $a->get($_); } $apool : ( $a->get_all_by_prop(type => "ibay" ) , $a->get_all_by_prop(type => "share" ));# unless $acc; |
46 |
|
|
|
47 |
|
|
-my $acc = $a->get($pool); |
48 |
|
|
- |
49 |
|
|
-die "$pool not found in the account database\n" unless $acc; |
50 |
|
|
-my $type = $acc->prop('type'); |
51 |
|
|
-my $dyn = 'disabled'; |
52 |
|
|
-if ( $type eq "ibay") { |
53 |
|
|
- $dyn = $acc->prop('CgiBin') || 'disabled'; |
54 |
|
|
-} |
55 |
|
|
-else { |
56 |
|
|
- $dyn = $acc->prop('DynamicContent') || 'disabled'; |
57 |
|
|
-} |
58 |
|
|
- |
59 |
|
|
-if ($dyn =~ m/^enabled|on|1|yes$/ && $event ne 'share-delete'){ |
60 |
|
|
- my @dirs = ( "/var/log/php/$pool", |
61 |
|
|
+foreach my $acc (@pools){ |
62 |
|
|
+ my $pool = $acc->key; |
63 |
|
|
+ my $type = $acc->prop('type'); |
64 |
|
|
+ my $dyn = 'disabled'; |
65 |
|
|
+ if ( $type eq "ibay") { |
66 |
|
|
+ $dyn = $acc->prop('CgiBin') || 'disabled'; |
67 |
|
|
+ } |
68 |
|
|
+ else { |
69 |
|
|
+ $dyn = $acc->prop('DynamicContent') || 'disabled'; |
70 |
|
|
+ } |
71 |
|
|
+ |
72 |
|
|
+ if ($dyn =~ m/^enabled|on|1|yes$/ && $event ne 'share-delete' && $event ne 'ibay-delete'){ |
73 |
|
|
+ my @dirs = ( "/var/log/php/$pool", |
74 |
|
|
"/var/lib/php/$pool/session", |
75 |
|
|
"/var/lib/php/$pool/wsdlcache", |
76 |
|
|
"/var/lib/php/$pool/opcache", |
77 |
|
|
"/var/lib/php/$pool/tmp" ); |
78 |
|
|
- make_path( @dirs, { |
79 |
|
|
- owner => 'root', |
80 |
|
|
- group => 'www' |
81 |
|
|
- }); |
82 |
|
|
- chmod 0770, @dirs; |
83 |
|
|
+ # create dir if does not exist; set owner and group if create it |
84 |
|
|
+ # does not change ownership if folder already exists |
85 |
|
|
+ for (@dirs){ |
86 |
|
|
+ esmith::util::chownFile("root", "www", $_) if -e $_; |
87 |
|
|
+ make_path( $_, { |
88 |
|
|
+ owner => 'root', |
89 |
|
|
+ group => 'www' |
90 |
|
|
+ }) unless -e $_; |
91 |
|
|
+ } |
92 |
|
|
+ chmod 0770, @dirs; |
93 |
|
|
+ } |
94 |
|
|
} |
95 |
|
|
-else{ |
96 |
|
|
- remove_tree( ( "/var/log/php/$pool", |
97 |
|
|
- " /var/lib/php/$pool/" ) ); |
98 |
|
|
+ |
99 |
|
|
+if ( defined $event && defined $apool && ($event eq 'share-delete' || $event eq 'ibay-delete') ) { |
100 |
|
|
+ my $acc = $a->get($apool); |
101 |
|
|
+ die "$apool not found in the account database\n" unless $acc; |
102 |
|
|
+ remove_tree( "/var/log/php/$apool", |
103 |
|
|
+ "/var/lib/php/$apool" ); |
104 |
|
|
} |
105 |
|
|
+ |