Skip to content

Commit d374cd4

Browse files
committed
prepare.sh: cleaning
1 parent 39c35a1 commit d374cd4

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

script/prepare.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
#!/bin/sh -e
22

3-
php_logs() {
4-
conf_file="/usr/local/etc/php-fpm.d/www.conf"
3+
html_dir="/var/www/html"
54

6-
log_dir="/var/log/php"
7-
access_log_file="${log_dir}/access.log"
8-
error_log_file="${log_dir}/error.log"
5+
www_folder() {
6+
mkdir -p "$1"
7+
chown -R www-data "$1"
8+
}
99

10-
mkdir -p "${log_dir}" \
11-
&& touch "${access_log_file}" \
12-
&& touch "${error_log_file}"
10+
www_file() {
11+
touch "$1"
12+
chown www-data "$1"
13+
}
1314

14-
chown -R www-data "${log_dir}"
15+
php_logs() {
16+
www_folder "/var/log/php"
17+
www_file "/var/log/php/access.log"
18+
www_file "/var/log/php/error.log"
1519

1620
# The "c" supplementary letter is needed because the first letter will be cut at replacement.
1721
sed -i \
@@ -23,15 +27,11 @@ php_logs() {
2327
-e '/^;php_admin_value\[error_log\]/cphp_admin_value[error_log] = /var/log/php/error.log' \
2428
-e '/^;php_admin_flag\[log_errors\]/cphp_admin_flag[log_errors] = on' \
2529
-e '/^;clear_env/cclear_env = no' \
26-
"${conf_file}"
30+
"/usr/local/etc/php-fpm.d/www.conf"
2731
}
2832

2933
symfony_logs() {
30-
html_dir="/var/www/html"
31-
var_dir="${html_dir}/var"
32-
33-
mkdir -p "${var_dir}"
34-
chown -R www-data "${var_dir}"
34+
www_folder "${html_dir}/var"
3535
}
3636

3737
php_logs

0 commit comments

Comments
 (0)