set timezone
Now we can set timezone for Ubuntu and PHP.
This commit is contained in:
parent
5348de5b95
commit
7f0acd43ca
19
lib/install
19
lib/install
|
@ -14,6 +14,22 @@ app_purge() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
set_timezone() {
|
||||||
|
if [[ -n $(conf_read timezone) ]] && grep -Fxq $(conf_read timezone) /opt/webinoly/lib/timezone.dat; then
|
||||||
|
[[ $1 == "os" || $1 == "all" ]] && sudo timedatectl set-timezone $(conf_read timezone)
|
||||||
|
# It's not compatible with multi-php feature.
|
||||||
|
if [[ ($1 == "php" || $1 == "all") && $(conf_read php) == "true" ]]; then
|
||||||
|
sudo sed -i "/date.timezone =/c\date.timezone = $(conf_read timezone)" /etc/php/$(conf_read php-ver)/fpm/php.ini
|
||||||
|
sudo service php*-fpm reload
|
||||||
|
fi
|
||||||
|
echo "${gre}Timezone: $(conf_read timezone) ${end}"
|
||||||
|
else
|
||||||
|
conf_delete timezone
|
||||||
|
echo "${red}Timezone not found or not valid!${end}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
linux_optim() {
|
linux_optim() {
|
||||||
api-events_update in4
|
api-events_update in4
|
||||||
if [[ $(conf_read linux-optim) == "true" ]]; then
|
if [[ $(conf_read linux-optim) == "true" ]]; then
|
||||||
|
@ -78,6 +94,7 @@ net.ipv4.tcp_max_syn_backlog = 3240000
|
||||||
sudo sed -i "/End of file/i \# WebinolyEnd" /etc/security/limits.conf
|
sudo sed -i "/End of file/i \# WebinolyEnd" /etc/security/limits.conf
|
||||||
|
|
||||||
swap_create
|
swap_create
|
||||||
|
set_timezone os
|
||||||
|
|
||||||
sudo sysctl -p
|
sudo sysctl -p
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
|
@ -289,7 +306,7 @@ php_optim() {
|
||||||
sudo sed -i "/post_max_size =/c\post_max_size = ${maxuploads}M" /etc/php/$ver/fpm/php.ini
|
sudo sed -i "/post_max_size =/c\post_max_size = ${maxuploads}M" /etc/php/$ver/fpm/php.ini
|
||||||
sudo sed -i '/max_file_uploads =/c\max_file_uploads = 20' /etc/php/$ver/fpm/php.ini
|
sudo sed -i '/max_file_uploads =/c\max_file_uploads = 20' /etc/php/$ver/fpm/php.ini
|
||||||
sudo sed -i '/session.cookie_httponly =/c\session.cookie_httponly = 1' /etc/php/$ver/fpm/php.ini
|
sudo sed -i '/session.cookie_httponly =/c\session.cookie_httponly = 1' /etc/php/$ver/fpm/php.ini
|
||||||
sudo sed -i '/date.timezone =/c\date.timezone = America/Mexico_City' /etc/php/$ver/fpm/php.ini
|
set_timezone php
|
||||||
|
|
||||||
sudo mkdir -p /var/log/php/$ver
|
sudo mkdir -p /var/log/php/$ver
|
||||||
sudo touch /var/log/php/$ver/fpm.log
|
sudo touch /var/log/php/$ver/fpm.log
|
||||||
|
|
|
@ -8,7 +8,7 @@ opt="$1"
|
||||||
source /opt/webinoly/lib/webin
|
source /opt/webinoly/lib/webin
|
||||||
|
|
||||||
# Extract value if exist
|
# Extract value if exist
|
||||||
if [[ $opt == "-tools-port="* || $opt == "-config-cache="* || $opt == "-clear-cache="* || $opt == "-server-update="* || $opt == "-server-reset="* ]]; then
|
if [[ $opt == "-tools-port="* || $opt == "-config-cache="* || $opt == "-clear-cache="* || $opt == "-server-update="* || $opt == "-server-reset="* || $opt == "-timezone="* ]]; then
|
||||||
value=$(echo "${opt}" | cut -d'=' -f 2 -s)
|
value=$(echo "${opt}" | cut -d'=' -f 2 -s)
|
||||||
opt=$(echo "${opt}" | cut -d'=' -f 1 -s)
|
opt=$(echo "${opt}" | cut -d'=' -f 1 -s)
|
||||||
fi
|
fi
|
||||||
|
@ -328,6 +328,19 @@ elif [[ $opt == "-clear-cache" ]]; then
|
||||||
echo "${red}[ERROR] We can not clear FastCGI Cache because NGINX is not installed!${end}"
|
echo "${red}[ERROR] We can not clear FastCGI Cache because NGINX is not installed!${end}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
elif [[ $opt == "-timezone" ]]; then
|
||||||
|
if [[ -z $value ]]; then
|
||||||
|
echo "${gre}"
|
||||||
|
echo "Please, enter a valid Timezone for Ubuntu and PHP."
|
||||||
|
echo "http://php.net/manual/en/timezones.php"
|
||||||
|
echo ""
|
||||||
|
read -p "${blu} Timezone: ${end}" value
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
conf_write timezone $value
|
||||||
|
set_timezone all
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue