1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Standardized messages, modified php config install order

This commit is contained in:
billz 2018-09-05 12:59:49 +00:00
parent e0e78cb0f9
commit 22c791e1f3

View File

@ -274,8 +274,9 @@ function patch_system_files() {
} }
# Change configuration of php-cgi. # Optimize configuration of php-cgi.
function reconfigure_php() { function optimize_php() {
install_log "Optimize PHP configuration"
if [ ! -f "$phpcgiconf" ]; then if [ ! -f "$phpcgiconf" ]; then
install_warning "PHP configuration could not be found." install_warning "PHP configuration could not be found."
return return
@ -286,18 +287,18 @@ function reconfigure_php() {
sudo cp "$phpcgiconf" "$raspap_dir/backups/php.ini.$datetimephpconf" sudo cp "$phpcgiconf" "$raspap_dir/backups/php.ini.$datetimephpconf"
sudo ln -sf "$raspap_dir/backups/php.ini.$datetimephpconf" "$raspap_dir/backups/php.ini" sudo ln -sf "$raspap_dir/backups/php.ini.$datetimephpconf" "$raspap_dir/backups/php.ini"
echo -n "Turn on httpOnly flag for session cookies(recommended)? [Y/n]: " echo -n "Enable HttpOnly for session cookies (Recommended)? [Y/n]: "
read answer read answer
if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then
install_log "Php-cgi enabling session.cookie_httponly." echo "Php-cgi enabling session.cookie_httponly."
sudo sed -i -E 's/^session\.cookie_httponly\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/session.cookie_httponly = 1/' "$phpcgiconf" sudo sed -i -E 's/^session\.cookie_httponly\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/session.cookie_httponly = 1/' "$phpcgiconf"
fi fi
if [ "$php_package" = "php7.0-cgi" ]; then if [ "$php_package" = "php7.0-cgi" ]; then
echo -n "Turn on php opcache? [Y/n]: " echo -n "Enable PHP OPCache? [Y/n]: "
read answer read answer
if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then if [ "$answer" != 'n' ] && [ "$answer" != 'N' ]; then
install_log "Php-cgi enabling opcache.enable." echo "Php-cgi enabling opcache.enable."
sudo sed -i -E 's/^;?opcache\.enable\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/opcache.enable = 1/' "$phpcgiconf" sudo sed -i -E 's/^;?opcache\.enable\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/opcache.enable = 1/' "$phpcgiconf"
# Make sure opcache extension is turned on. # Make sure opcache extension is turned on.
if [ -f "/usr/sbin/phpenmod" ]; then if [ -f "/usr/sbin/phpenmod" ]; then
@ -307,9 +308,6 @@ function reconfigure_php() {
fi fi
fi fi
fi fi
# Apply new php configuration.
sudo service lighttpd reload
} }
function install_complete() { function install_complete() {
@ -329,6 +327,7 @@ function install_raspap() {
config_installation config_installation
update_system_packages update_system_packages
install_dependencies install_dependencies
optimize_php
enable_php_lighttpd enable_php_lighttpd
create_raspap_directories create_raspap_directories
check_for_old_configs check_for_old_configs
@ -338,6 +337,5 @@ function install_raspap() {
move_config_file move_config_file
default_configuration default_configuration
patch_system_files patch_system_files
reconfigure_php
install_complete install_complete
} }