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

Fix upgrade

This commit is contained in:
yalh76 2021-05-24 12:31:28 +02:00
parent b2132a7291
commit 85a1fc63ba
5 changed files with 122 additions and 112 deletions

View file

@ -14,6 +14,7 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
#3.2.4~ynh1
upgrade=1 from_commit=e079b0d81e698c9cde7e9ce50b29da1d5715bf65 upgrade=1 from_commit=e079b0d81e698c9cde7e9ce50b29da1d5715bf65
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1

View file

@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false
SOURCE_FILENAME= SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,65 +1,65 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/ ; alias __FINALPATH__/ ;
# Force usage of https # Force usage of https
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
index index.php; index index.php;
client_max_body_size 30M; client_max_body_size 30M;
try_files $uri $uri/ index.php; try_files $uri $uri/ index.php;
if (!-e $request_filename) if (!-e $request_filename)
{ {
rewrite ^/([^/]*)/robots\.txt$ __PATH__/spip.php?page=robots.txt last; rewrite ^/([^/]*)/robots\.txt$ __PATH__/spip.php?page=robots.txt last;
rewrite ^/([^/]*)/sitemap\.xml$ __PATH__/spip.php?page=sitemap.xml last; rewrite ^/([^/]*)/sitemap\.xml$ __PATH__/spip.php?page=sitemap.xml last;
rewrite ^(.+)$ __PATH__/index.php?q=$1 last; rewrite ^(.+)$ __PATH__/index.php?q=$1 last;
} }
# Add headers to serve security related headers # Add headers to serve security related headers
more_set_headers 'Strict-Transport-Security: max-age=15768000'; more_set_headers 'Strict-Transport-Security: max-age=15768000';
more_set_headers 'X-Content-Type-Options: nosniff'; more_set_headers 'X-Content-Type-Options: nosniff';
more_set_headers 'X-Frame-Options: SAMEORIGIN'; more_set_headers 'X-Frame-Options: SAMEORIGIN';
more_set_headers 'X-XSS-Protection: 1, mode=block'; more_set_headers 'X-XSS-Protection: 1, mode=block';
more_set_headers 'X-Robots-Tag: none'; more_set_headers 'X-Robots-Tag: none';
more_set_headers 'X-Download-Options: noopen'; more_set_headers 'X-Download-Options: noopen';
more_set_headers 'X-Permitted-Cross-Domain-Policies: none'; more_set_headers 'X-Permitted-Cross-Domain-Policies: none';
location ~^/(tmp|config|\.ht)/{ location ~^/(tmp|config|\.ht)/{
deny all; deny all;
} }
location ~* \.(jpg|jpeg|gif|css|png|js|ico|swf|mp3|pdf)$ { location ~* \.(jpg|jpeg|gif|css|png|js|ico|swf|mp3|pdf)$ {
# Le contenu statique, est signalé au navigateur comme étant # Le contenu statique, est signalé au navigateur comme étant
# à garder en cache une semaine. Si il y a un proxy sur la # à garder en cache une semaine. Si il y a un proxy sur la
# route, celui-ci est autorisé à faire une copie et à la # route, celui-ci est autorisé à faire une copie et à la
# cacher. # cacher.
rewrite ^/([^/]*)/favicon\.ico$ __PATH__/spip.php?page=favicon.ico last; rewrite ^/([^/]*)/favicon\.ico$ __PATH__/spip.php?page=favicon.ico last;
expires 1w; expires 1w;
more_set_headers 'Cache-Control: public'; more_set_headers 'Cache-Control: public';
} }
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
set $ecrire 0; set $ecrire 0;
if ($uri ~ ^/ecrire.*) { if ($uri ~ ^/ecrire.*) {
set $ecrire 1; set $ecrire 1;
} }
} }
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }

View file

@ -1,64 +1,64 @@
{ {
"name": "SPIP", "name": "SPIP",
"id": "spip", "id": "spip",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "CMS with a focus on collaborative edition and multilingualism", "en": "CMS with a focus on collaborative edition and multilingualism",
"fr": "CMS conçu pour l'édition collaborative et le multilinguisme" "fr": "CMS conçu pour l'édition collaborative et le multilinguisme"
}, },
"version": "3.2.11~ynh2", "version": "3.2.11~ynh2",
"url": "http://www.spip.net/", "url": "http://www.spip.net/",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {
"name": "cyp", "name": "cyp",
"email": "cyp@rouquin.me" "email": "cyp@rouquin.me"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.0" "yunohost": ">= 4.1.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"example": "example.com" "example": "example.com"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"example": "/spip", "example": "/spip",
"default": "/spip" "default": "/spip"
}, },
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user",
"example": "johndoe" "example": "johndoe"
}, },
{ {
"name": "password", "name": "password",
"type": "password", "type": "password",
"example": "Choose a password" "example": "Choose a password"
}, },
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"default": true "default": true
}, },
{ {
"name": "users_status", "name": "users_status",
"type": "string", "type": "string",
"ask": { "ask": {
"en": "Choose the status of YunoHost users", "en": "Choose the status of YunoHost users",
"fr": "Choisissez le status des utilisateurs de YunoHost" "fr": "Choisissez le status des utilisateurs de YunoHost"
}, },
"choices": ["Administrator", "Editor", "Visitor"], "choices": ["Administrator", "Editor", "Visitor"],
"default": "Editor" "default": "Editor"
} }
] ]
} }
} }

View file

@ -24,6 +24,7 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
users_status=$(ynh_app_setting_get --app=$app --key=users_status) users_status=$(ynh_app_setting_get --app=$app --key=users_status)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#================================================= #=================================================
@ -99,8 +100,8 @@ if [ -z $password ]; then
ynh_app_setting_set --app=$app --key=password --value=$password ynh_app_setting_set --app=$app --key=password --value=$password
fi fi
if ynh_legacy_permissions_exists # Cleaning legacy permissions
then if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all ynh_legacy_permissions_delete_all
fi fi
@ -161,10 +162,11 @@ ynh_add_fpm_config --package="$extra_php_dependencies"
#================================================= #=================================================
# SETUP APPLICATION WITH CURL # SETUP APPLICATION WITH CURL
#================================================= #=================================================
ynh_script_progression --message="Setuping application with CURL..."
# Set right permissions for curl install # Set right permissions for curl install
mkdir -p $final_path/plugins/auto mkdir -p $final_path/plugins/auto
chown -R $app: $final_path chown -R $app:www-data "$final_path"
# Set the app as temporarily public for curl call # Set the app as temporarily public for curl call
ynh_script_progression --message="Configuring SSOwat..." ynh_script_progression --message="Configuring SSOwat..."
@ -175,6 +177,8 @@ ynh_backup_if_checksum_is_different --file="$final_path/config/connect.php"
ynh_secure_remove --file="$final_path/config/connect.php" ynh_secure_remove --file="$final_path/config/connect.php"
# Installation with curl
ynh_script_progression --message="Finalizing installation..."
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=chmod" ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=chmod"
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=755" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=755" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql"
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "choix_db=$db_name" "tprefix=$db_name" ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "choix_db=$db_name" "tprefix=$db_name"
@ -208,10 +212,14 @@ ynh_permission_update --permission="main" --remove="visitors"
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..."
#ynh_replace_string --match_string="'','utf8');" --replace_string="'ldap.php','utf8');" --target_file=$final_path/config/connect.php #ynh_replace_string --match_string="'','utf8');" --replace_string="'ldap.php','utf8');" --target_file=$final_path/config/connect.php
cp ../conf/mes_options.php $final_path/config/mes_options.php cp ../conf/mes_options.php $final_path/config/mes_options.php
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_store_file_checksum --file="$final_path/config/connect.php" ynh_store_file_checksum --file="$final_path/config/connect.php"
#================================================= #=================================================