@@ -163,20 +163,20 @@ function fix_onwership() {
163
163
case $simulate in
164
164
0)
165
165
# Real action.
166
- find " $1 " \( ! -user $drupal_user -o ! -group $httpd_group \) -print0 | xargs -r -0 -L20 chown $drupal_user :$httpd_group
166
+ find " $1 " $detected_vendor_path \( ! -user $drupal_user -o ! -group $httpd_group \) -print0 | xargs -r -0 -L20 chown $drupal_user :$httpd_group
167
167
;;
168
168
169
169
1)
170
170
# Simulate.
171
171
printf " \n Items with wrong ownership: "
172
- find " $1 " \( ! -user $drupal_user -o ! -group $httpd_group \) -print | wc -l
172
+ find " $1 " $detected_vendor_path \( ! -user $drupal_user -o ! -group $httpd_group \) -print | wc -l
173
173
;;
174
174
175
175
2)
176
176
# Simulate verbosely.
177
177
printf " \n Files and directories that would have their ownership fixed: "
178
178
# Use a variable to indent output.
179
- items=$( find " $1 " \( ! -user $drupal_user -o ! -group $httpd_group \) -print)
179
+ items=$( find " $1 " $detected_vendor_path -type f -type -d \( ! -user $drupal_user -o ! -group $httpd_group \) -print)
180
180
items=${items:- None}
181
181
printf " \n ${items// $' \n ' / $' \n ' } \n"
182
182
;;
@@ -196,20 +196,20 @@ function fix_code_permission_helper() {
196
196
case $simulate in
197
197
0)
198
198
# Real action.
199
- find " $1 " \( -path " $1 " /sites/* /$file_folder_name -prune \) -o \( -path " $1 " /sites/* /$private_folder_name -prune \) -o \( -type $2 ! -perm $3 -print0 \) | xargs -r -0 -L4 chmod $3
199
+ find " $1 " $detected_vendor_path \( -path " $1 " /sites/* /$file_folder_name -prune \) -o \( -path " $1 " /sites/* /$private_folder_name -prune \) -o \( -type $2 ! -perm $3 -print0 \) | xargs -r -0 -L4 chmod $3
200
200
;;
201
201
202
202
1)
203
203
# Simulate.
204
- num=$( find " $1 " \( -path " $1 " /sites/* /$file_folder_name -prune \) -o \( -path " $1 " /sites/* /$private_folder_name -prune \) -o \( -type $2 ! -perm $3 -print \) | wc -l)
204
+ num=$( find " $1 " $detected_vendor_path \( -path " $1 " /sites/* /$file_folder_name -prune \) -o \( -path " $1 " /sites/* /$private_folder_name -prune \) -o \( -type $2 ! -perm $3 -print \) | wc -l)
205
205
printf " \n Code items with wrong permissions: $num "
206
206
;;
207
207
208
208
2)
209
209
# Simulate verbosely.
210
210
printf " \n Code files and directories that would have their permissions fixed: "
211
211
# Use a variable to indent output.
212
- items=$( find " $1 " \( -path " $1 " /sites/* /$file_folder_name -prune \) -o \( -path " $1 " /sites/* /$private_folder_name -prune \) -o \( -type $2 ! -perm $3 -print \) )
212
+ items=$( find " $1 " $detected_vendor_path \( -path " $1 " /sites/* /$file_folder_name -prune \) -o \( -path " $1 " /sites/* /$private_folder_name -prune \) -o \( -type $2 ! -perm $3 -print \) )
213
213
items=${items:- None}
214
214
printf " \n ${items// $' \n ' / $' \n ' } \n"
215
215
;;
@@ -377,6 +377,8 @@ content_file_perms='ug=rw,o='
377
377
cd $drupal_path
378
378
complete_drupal_path=$( pwd)
379
379
380
+ # Check if there's a vendor folder in the upper folder.
381
+ [ -d " ../vendor" ] && [ -f " ../composer.json" ] && detected_vendor_path=" ../vendor"
380
382
381
383
382
384
# Show current configuration.
@@ -387,6 +389,7 @@ Owner user: $drupal_user
387
389
Owner group: $httpd_group
388
390
Code dirs perms: $code_dir_perms
389
391
Code files perms: $code_file_perms
392
+ Separated vendor folder detected: ${detected_vendor_path:- " No" }
390
393
Content dirs perms: $content_dir_perms
391
394
Content files perms: $content_file_perms
392
395
File folder name: $file_folder_name
398
401
fi
399
402
400
403
401
-
402
404
# Sanity checks.
403
405
# ###############
404
406
#
0 commit comments