1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/spip_ynh.git synced 2024-09-03 20:25:59 +02:00
spip_ynh/scripts/upgrade

68 lines
2 KiB
Text
Raw Normal View History

2015-04-28 17:32:31 +02:00
#!/bin/bash
# Retrieve arguments
domain=$(sudo yunohost app setting spip domain)
path=$(sudo yunohost app setting spip path)
admin_spip=$(sudo yunohost app setting spip admin)
language=$(sudo yunohost app setting spip language)
is_public=$(sudo yunohost app setting spip is_public)
root_pwd=$(sudo cat /etc/yunohost/mysql)
final_path=/var/www/spip
db_name=spip
2015-04-28 18:46:07 +02:00
# if [[ "$admin_spip" = "" ]];
# then
# mysql -u root -p$root_pwd $db_name -e "select MAX(user_login) from wp_users where user_status=0 INTO OUTFILE '/tmp/spipuser';"
# admin_spip=$(cat /tmp/spipuser)
# sudo rm -f /tmp/spipuser
# fi
2015-04-28 17:32:31 +02:00
2015-04-28 18:46:07 +02:00
# if [[ "$language" = "" ]];
# then
# language=$(sudo grep WPLANG $final_path/wp-config.php | cut -d"'" -f4)
# fi
2015-04-28 17:32:31 +02:00
2015-04-28 18:46:07 +02:00
# if [[ "$is_public" = "" ]];
# then
# mysql -u root -p$root_pwd $db_name -e "select option_value from wp_options WHERE option_name='active_plugins' INTO OUTFILE '/tmp/spipispublic';"
# grep -q http-authentication /tmp/spipispublic
# if [[ $? -eq 0 ]];
# then
# is_public=Yes
# else
# is_public=No
# fi
# sudo rm -f /tmp/spipispublic
# fi
2015-04-28 17:32:31 +02:00
# Check if admin is not null
if [[ "$admin_spip" = "" || "$is_public" = "" || "$language" = "" ]]; then
echo "Unable to upgrade, please contact support"
exit 1
fi
# Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
if [ $is_public = "Yes" ];
then
sudo cp ../conf/nginx.conf-public /etc/nginx/conf.d/$domain.d/spip.conf
2015-04-28 18:46:07 +02:00
# grep -q "define('FORCE_SSL_ADMIN', true);" $final_path/wp-config.php
# if [[ ! $? -eq 0 ]];
# then
# echo "define('FORCE_SSL_ADMIN', true);" | sudo tee -a $final_path/config/connect.php
# else
# sudo sed -i "s@//define('FORCE_SSL_ADMIN@define('FORCE_SSL_ADMIN@g" $final_path/config/connect.php
# fi
2015-04-28 17:32:31 +02:00
else
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/spip.conf
fi
# Reload Nginx
sudo service nginx reload