From 802a15a0569349d2178291d32f8455c92ea583e3 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Thu, 26 May 2016 22:49:54 +0200 Subject: [PATCH] Corrections droits pour maj --- scripts/install | 25 +++++++------------------ scripts/restore | 3 +++ scripts/upgrade | 26 ++++---------------------- 3 files changed, 14 insertions(+), 40 deletions(-) diff --git a/scripts/install b/scripts/install index b06d6b5..d66e0c5 100644 --- a/scripts/install +++ b/scripts/install @@ -203,29 +203,21 @@ then sudo sed -i "s@//--MULTISITE1--define@define@g" $final_path/wp-config.php # Active le multisite via wp-cli. - php $final_path/wp-cli.phar core multisite-convert --path=$final_path --base=$path/ - echo "The 2 warnings of php about \"Permission denied\" on wp-config.php are normal. The install script writing into this file, not wp-cli!" + php $final_path/wp-cli.phar core multisite-convert --path=$final_path --base=$path/ > /dev/null 2>&1 +# echo "The 2 warnings of php about \"Permission denied\" on wp-config.php are normal. The install script writing into this file, not wp-cli!" # Active le multisite wordpress sudo sed -i "s@//--MULTISITE2--define@define@g" $final_path/wp-config.php # Charge les commandes sql pour activer les plugins -# if [ "$is_public" = "No" ]; -# then -# sudo sed -i "s@#--PRIVATE--@@g" ../conf/sql/multisite.sql -# else -# sudo sed -i "s@#--PUBLIC--@@g" ../conf/sql/multisite.sql -# fi mysql --debug-check -u $db_user -p$db_pwd $db_user < ../conf/sql/multisite.sql else if [ "$is_public" = "No" ]; then sudo sed -i "s@#--PRIVATE--@@g" /etc/nginx/conf.d/$domain.d/$app.conf -# sudo sed -i "s@#--PRIVATE--@@g" ../conf/sql/single.sql else sudo sed -i "s@//--PUBLIC--define@define@g" $final_path/wp-config.php sudo sed -i "s@#--PRIVATE--@#@g" /etc/nginx/conf.d/$domain.d/$app.conf -# sudo sed -i "s@#--PUBLIC--@@g" ../conf/sql/single.sql fi # Charge les commandes sql pour activer les plugins mysql --debug-check -u $db_user -p$db_pwd $db_user < ../conf/sql/single.sql @@ -238,14 +230,10 @@ mysql --debug-check -u $db_user -p$db_pwd $db_user < ../conf/sql/common.sql sudo sed -i "s@//add_filter@add_filter@g" $final_path/wp-config.php # Configure les droits d'accès au fichiers -# -rw-r--r-- sur les fichiers -sudo find $final_path -type f -print0 | xargs -0 sudo chmod 644 -# drwxr-xr-x sur les dossiers -sudo find $final_path -type d -print0 | xargs -0 sudo chmod 755 -# Les fichiers appartiennent à root -sudo chown -R root: $final_path -# Sauf le dossier wp-content qui appartient à www-data -sudo chown -R www-data:root $final_path/wp-content +# Les fichiers appartiennent à www-data, pour permettre les mises à jour. +sudo chown -R www-data: $final_path +# Sauf le fichier de config wp-config.php qui appartient à root +sudo chown root: $final_path/wp-config.php if [ "$is_public" = "No" ]; then @@ -258,5 +246,6 @@ fi sudo sed -i '/#wordpress_yunohost/d' /etc/hosts sudo service nginx reload + # wp-cli me semble un peu trop permissif... Il a terminé son travail... sudo rm -f $final_path/wp-cli.phar diff --git a/scripts/restore b/scripts/restore index cb98669..fd7566a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -36,7 +36,10 @@ sudo sed -i -e "s/'DB_USER', *'[^']*'/'DB_USER', '$app'/g" $final_path/wp-config sudo sed -i -e "s/'DB_NAME', *'[^']*'/'DB_NAME', '$app'/g" $final_path/wp-config.php # Set permissions +# Les fichiers appartiennent à www-data, pour permettre les mises à jour. sudo chown -R www-data: $final_path +# Sauf le fichier de config wp-config.php qui appartient à root +sudo chown root: $final_path/wp-config.php # Restore conf files conf=/etc/nginx/conf.d/$domain.d/$app.conf diff --git a/scripts/upgrade b/scripts/upgrade index d4ca20f..8f75606 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,20 +37,6 @@ then sudo yunohost app setting $app language -v $language fi -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/wordpressispublic';" - grep -q http-authentication /tmp/wordpressispublic - if [[ $? -eq 0 ]]; - then - is_public=Yes - else - is_public=No - fi - sudo rm -f /tmp/wordpressispublic - sudo yunohost app setting $app is_public -v $is_public -fi - # Check if admin is not null if [[ "$admin_wordpress" = "" || "$is_public" = "" || "$language" = "" ]]; then echo "Unable to upgrade, please contact support" @@ -91,14 +77,10 @@ fi sudo yunohost app setting $app multisite -v $multisite # Configure les droits d'accès au fichiers -# -rw-r--r-- sur les fichiers -sudo find $final_path -type f -print0 | xargs -0 sudo chmod 644 -# drwxr-xr-x sur les dossiers -sudo find $final_path -type d -print0 | xargs -0 sudo chmod 755 -# Les fichiers appartiennent à root -sudo chown -R root: $final_path -# Sauf le dossier wp-content qui appartient à www-data -sudo chown -R www-data:root $final_path/wp-content +# Les fichiers appartiennent à www-data, pour permettre les mises à jour. +sudo chown -R www-data: $final_path +# Sauf le fichier de config wp-config.php qui appartient à root +sudo chown root: $final_path/wp-config.php sudo yunohost app setting $app skipped_uris -d # Retire le skipped_uris si il existe encore.