diff --git a/README.md b/README.md
index ae604ff..f67b07a 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,71 @@
-# abantecart_ynh
-Plateforme pour la création de site Ecommerce / Business solution provider
+# Abantecart for YunoHost
-## FONCTIONNE / WORK
-#### N'UTILSER QUE POUR TEST OU DEVELOPPEMENT !! / USE ONLY FOR TEST OR DEVELOPPMENT !!
-
-
-## Upgrade this package:
-`sudo yunohost app upgrade --verbose abantecart -u https://github.com/YunoHost-Apps/abantecart_ynh`
-
-
-level/niveau=2 (Installation et supression)
-
+[](https://dash.yunohost.org/appci/app/abantecart)  
+[](https://install-app.yunohost.org/?app=abantecart)
+
+*[Lire ce readme en français.](./README_fr.md)*
+
+> *This package allows you to install abantecart quickly and simply on a YunoHost server.
+If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
+
+## Overview
+Plateforme pour la création de site Ecommerce/Business solution provider
+
+**Shipped version:** 1.2.12
+
+## Screenshots
+
+
+
+## Demo
+
+* [Official demo](Link to a demo site for this app.)
+
+## Configuration
+
+How to configure this app: From an admin panel, a plain file with SSH, or any other way.
+
+## Documentation
+
+ * Official documentation: Link to the official documentation of this app
+ * YunoHost documentation: If specific documentation is needed, feel free to contribute.
+
+## YunoHost specific features
+
+#### Multi-user support
+
+* Are LDAP and HTTP auth supported?
+* Can the app be used by multiple users?
+
+#### Supported architectures
+
+* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/abantecart/)
+* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/abantecart/)
+
+## Limitations
+
+* Any known limitations.
+
+## Additional information
+
+* Other info you would like to add about this app.
+
+## Links
+
+ * Report a bug: https://github.com/YunoHost-Apps/abantecart_ynh/issues
+ * App website: Link to the official website of this app.
+ * Upstream app repository: Link to the official repository of the upstream app.
+ * YunoHost website: https://yunohost.org/
+
+---
+
+## Developer info
+
+Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing).
+
+To try the testing branch, please proceed like that.
+```
+sudo yunohost app install https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing --debug
+or
+sudo yunohost app upgrade abantecart -u https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing --debug
+```
diff --git a/check_process b/check_process
index 15d0de2..2141666 100644
--- a/check_process
+++ b/check_process
@@ -26,13 +26,5 @@
port_already_use=0
final_path_already_use=1
;;; Levels
- Level 1=auto
- Level 2=auto
- Level 3=auto
- Level 4=na
Level 5=auto
- Level 6=auto
- Level 7=auto
- Level 8=0
- Level 9=0
- Level 10=0
+
diff --git a/conf/nginx.conf b/conf/nginx.conf
index c3a9d98..b7f1a57 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -64,7 +64,7 @@ location __PATH__/ {
# Execute and serve PHP files
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
- fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
+ fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf
index bec24c0..5869080 100644
--- a/conf/php-fpm.conf
+++ b/conf/php-fpm.conf
@@ -33,7 +33,7 @@ group = __USER__
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
-listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock
+listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
diff --git a/manifest.json b/manifest.json
index b6dfdbc..78a38a4 100644
--- a/manifest.json
+++ b/manifest.json
@@ -6,7 +6,7 @@
"en": "Create a E-commerce Website",
"fr": "Créer un site ecommerce"
},
- "version": "1.2.12",
+ "version": "1.2.12~ynh1",
"license": "free",
"url": "abantecart.com",
"maintainer": {
@@ -14,7 +14,7 @@
"email": "win10@tutanota.com"
},
"requirements": {
- "yunohost": ">= 3.0.0"
+ "yunohost": ">= 4.0.0"
},
"multi_instance": true,
"services": [
diff --git a/scripts/_common.sh b/scripts/_common.sh
index a9bf588..12c95d7 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -1 +1,21 @@
#!/bin/bash
+
+#=================================================
+# COMMON VARIABLES
+#=================================================
+
+YNH_PHP_VERSION="7.3"
+
+extra_php_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd"
+
+#=================================================
+# PERSONAL HELPERS
+#=================================================
+
+#=================================================
+# EXPERIMENTAL HELPERS
+#=================================================
+
+#=================================================
+# FUTURE OFFICIAL HELPERS
+#=================================================
diff --git a/scripts/backup b/scripts/backup
index f963e1f..98466c5 100644
--- a/scripts/backup
+++ b/scripts/backup
@@ -6,12 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
-if [ ! -e _common.sh ]; then
- # Get the _common.sh file if it's not in the current directory
- cp ../settings/scripts/_common.sh ./_common.sh
- chmod a+rx _common.sh
-fi
-source _common.sh
+source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
@@ -24,12 +19,14 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
+ynh_print_info --message="Declaring files to be backed up..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
db_name=$(ynh_app_setting_get $app db_name)
+phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# STANDARD BACKUP STEPS
@@ -49,8 +46,8 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
-ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
-ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
+ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
+ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/20-$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
@@ -58,7 +55,6 @@ ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
ynh_mysql_dump_db "$db_name" > db.sql
-
#=================================================
# SPECIFIC BACKUP
#=================================================
@@ -66,3 +62,9 @@ ynh_mysql_dump_db "$db_name" > db.sql
#=================================================
ynh_backup "/etc/logrotate.d/$app"
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
diff --git a/scripts/change_url b/scripts/change_url
index 4972ad6..2fc8bd2 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -22,13 +22,29 @@ new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
-# CHECK THE SYNTAX OF THE PATHS
+# LOAD SETTINGS
#=================================================
+ynh_script_progression --message="Loading installation settings..." --time --weight=1
-test -n "$old_path" || old_path="/"
-test -n "$new_path" || new_path="/"
-new_path=$(ynh_normalize_url_path $new_path)
-old_path=$(ynh_normalize_url_path $old_path)
+# Needed for helper "ynh_add_nginx_config"
+final_path=$(ynh_app_setting_get --app=$app --key=final_path)
+
+#=================================================
+# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
+#=================================================
+ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1
+
+# Backup the current version of the app
+ynh_backup_before_upgrade
+ynh_clean_setup () {
+ # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
+ ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
+
+ # restore it if the upgrade fails
+ ynh_restore_upgradebackup
+}
+# Exit if an error occurs during the execution of the script
+ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
@@ -51,6 +67,7 @@ fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
+ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@@ -80,8 +97,23 @@ fi
#=================================================
# GENERIC FINALISATION
+#=================================================
+# START SYSTEMD SERVICE
+#=================================================
+ynh_script_progression --message="Starting a systemd service..." --time --weight=1
+
+ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
+
#=================================================
# RELOAD NGINX
#=================================================
+ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
+
+ynh_systemd_action --service_name=nginx --action=reload
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression --message="Change of URL completed for $app" --time --last
-systemctl reload nginx
diff --git a/scripts/install b/scripts/install
index 3ccfe50..1b5d037 100644
--- a/scripts/install
+++ b/scripts/install
@@ -32,6 +32,7 @@ admin_email=$YNH_APP_ARG_ADMIN_EMAIL
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
+ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
@@ -39,16 +40,8 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
-# Check web path availability
-ynh_webpath_available $domain $path_url
# Register (book) web path
-ynh_webpath_register $app $domain $path_url
-
-#=================================================
-# INSTALL DEPENDENCIES
-#=================================================
-
-ynh_install_app_dependencies php-mysql php-zip php-gd
+ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# Check password strength
@@ -67,23 +60,26 @@ ynh_app_setting_set "$app" admin_pass "$admin_pass"
ynh_app_setting_set "$app" admin_name "$admin_name"
ynh_app_setting_set "$app" admin_email "$admin_email"
+#=================================================
+# STANDARD MODIFICATIONS
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
-# If your app uses a MySQL database, you can use these lines to bootstrap
-# a database, an associated user and save the password in app settings
+ynh_script_progression --message="Creating a MySQL database..." --weight=2
db_name=$(ynh_sanitize_dbid $app)
-ynh_app_setting_set $app db_name $db_name
-ynh_mysql_setup_db $db_name $db_name
+ynh_app_setting_set --app=$app --key=db_name --value=$db_name
+ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name
+db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
+ynh_script_progression --message="Setting up source files..." --weight=7
-ynh_app_setting_set $app final_path $final_path
+ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
-ynh_setup_source "$final_path"
+ynh_setup_source --dest_dir="$final_path"
#=================================================
# SPECIFIC SETUP
@@ -115,7 +111,7 @@ popd
#=================================================
pushd $final_path/install/
-php cli_install.php install \
+php$phpversion cli_install.php install \
--db_host=localhost \
--db_user=$db_name \
--db_password=$db_pwd \
@@ -133,30 +129,33 @@ popd
#=================================================
# NGINX CONFIGURATION
#=================================================
+ynh_script_progression --message="Configuring NGINX web server..." --weight=2
-# Create a dedicated nginx config
+# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
+ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user
-ynh_system_user_create $app
+ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
# Create a dedicated php-fpm config
-ynh_add_fpm_config
+ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies"
+phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# Set permissions
#=================================================
# file owned by www-data before checking permissions
-chown $app:$app $final_path -R
+chown -R $app: $final_path
#=================================================
# SETUP LOGROTATE
@@ -183,5 +182,13 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
+ynh_script_progression --message="Reloading NGINX web server..." --weight=2
+
+ynh_systemd_action --service_name=nginx --action=reload
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression --message="Installation of $app completed" --last
-systemctl reload nginx
diff --git a/scripts/restore b/scripts/restore
index 1918a4e..e5d53c3 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -6,11 +6,6 @@
# IMPORT GENERIC HELPERS
#=================================================
-if [ ! -e _common.sh ]; then
- # Get the _common.sh file if it's not in the current directory
- cp ../settings/scripts/_common.sh ./_common.sh
- chmod a+rx _common.sh
-fi
source _common.sh
source /usr/share/yunohost/helpers
@@ -32,6 +27,7 @@ path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name)
db_pass=$(ynh_app_setting_get $app db_pass)
+phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
diff --git a/scripts/upgrade b/scripts/upgrade
index 520985b..50df3ba 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -21,6 +21,7 @@ admin_name=$(ynh_app_setting_get $app admin_name)
admin_pass=$(ynh_app_setting_get $app admin_pass)
admin_email=$(ynh_app_setting_get $app admin_email)
db_user=$(ynh_app_setting_get $app db_user)
+phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY