diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf
deleted file mode 100644
index 017da9e..0000000
--- a/conf/extra_php-fpm.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-; Additional php.ini defines, specific to this pool of workers.
-
-php_admin_value[upload_max_filesize] = 256M
-php_admin_value[post_max_size] = 256M
diff --git a/conf/nginx.conf b/conf/nginx.conf
index fbc832f..956af7b 100755
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -20,7 +20,7 @@ location __PATH__/ {
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
- fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
+ fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
fastcgi_index index.php;
include fastcgi_params;
diff --git a/config_panel.toml.example b/config_panel.toml.example
deleted file mode 100644
index ebde086..0000000
--- a/config_panel.toml.example
+++ /dev/null
@@ -1,25 +0,0 @@
-version = "1.0"
-
-[main]
-name = "Abantecart configuration"
-
- [main.php_fpm_config]
- name = "PHP-FPM configuration"
-
- [main.php_fpm_config.fpm_footprint]
- ask = "Memory footprint of the service?"
- choices = ["low", "medium", "high", "specific"]
- default = "low"
- help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.
Use specific to set a value with the following option."
-
- [main.php_fpm_config.free_footprint]
- ask = "Memory footprint of the service?"
- type = "number"
- default = "0"
- help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
-
- [main.php_fpm_config.fpm_usage]
- ask = "Expected usage of the service?"
- choices = ["low", "medium", "high"]
- default = "low"
- help = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.
medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.
high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."
diff --git a/manifest.toml b/manifest.toml
index 1a1bb88..3411d94 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -18,7 +18,8 @@ userdoc = "https://abantecart.atlassian.net/wiki/spaces/AD/overview?homepageId=3
code = "https://github.com/abantecart/abantecart-src"
[integration]
-yunohost = ">= 11.2.20"
+yunohost = ">= 11.2.18"
+helpers_version = "2.1"
architectures = "all"
multi_instance = false
ldap = false
@@ -51,6 +52,7 @@ ram.runtime = "50M"
[resources.system_user]
[resources.install_dir]
+ group = "www-data:r-x"
[resources.permissions]
main.url = "/"
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 944a65e..3d7f008 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -1,17 +1,5 @@
#!/bin/bash
#=================================================
-# COMMON VARIABLES
-#=================================================
-
-#=================================================
-# PERSONAL HELPERS
-#=================================================
-
-#=================================================
-# EXPERIMENTAL HELPERS
-#=================================================
-
-#=================================================
-# FUTURE OFFICIAL HELPERS
+# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
diff --git a/scripts/backup b/scripts/backup
index 30f2c81..5dd8e98 100644
--- a/scripts/backup
+++ b/scripts/backup
@@ -1,43 +1,34 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# DECLARE DATA AND CONF FILES TO BACKUP
-#=================================================
-ynh_print_info --message="Declaring files to be backed up..."
+ynh_print_info "Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
-ynh_backup --src_path="$install_dir"
+ynh_backup "$install_dir"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
-ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
+ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
-ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
+ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
-ynh_print_info --message="Backing up the MySQL database..."
+ynh_print_info "Backing up the MySQL database..."
-ynh_mysql_dump_db --database="$db_name" > db.sql
+ynh_mysql_dump_db > db.sql
#=================================================
# END OF SCRIPT
#=================================================
-ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
+ynh_print_info "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 4ba8cf7..39d37fc 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -1,23 +1,17 @@
#!/bin/bash
-#=================================================
-# GENERIC STARTING
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
-ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
+ynh_script_progression "Updating NGINX web server configuration..."
-ynh_change_url_nginx_config
+ynh_config_change_url_nginx
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Change of URL completed for $app" --last
+ynh_script_progression "Change of URL completed for $app"
diff --git a/scripts/config b/scripts/config
deleted file mode 100644
index 3440bd2..0000000
--- a/scripts/config
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/bash
-
-#=================================================
-# GENERIC STARTING
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
-source _common.sh
-source /usr/share/yunohost/helpers
-
-ynh_abort_if_errors
-
-#=================================================
-# RETRIEVE ARGUMENTS
-#=================================================
-
-phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
-current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
-
-#=================================================
-# SPECIFIC GETTERS FOR TOML SHORT KEY
-#=================================================
-
-get__fpm_footprint() {
- # Free footprint value for php-fpm
- # Check if current_fpm_footprint is an integer
- if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
- then
- echo "specific"
- else
- echo "$current_fpm_footprint"
- fi
-}
-
-get__free_footprint() {
- # Free footprint value for php-fpm
- # Check if current_fpm_footprint is an integer
- if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
- then
- # If current_fpm_footprint is an integer, that's a numeric value for the footprint
- echo "$current_fpm_footprint"
- else
- echo "0"
- fi
-}
-
-#=================================================
-# SPECIFIC SETTERS FOR TOML SHORT KEYS
-#=================================================
-
-set__fpm_footprint() {
- if [ "$fpm_footprint" != "specific" ]
- then
- ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
- fi
-}
-
-set__free_footprint() {
- if [ "$fpm_footprint" = "specific" ]
- then
- ynh_app_setting_set --app=$app --key=fpm_footprint --value="$free_footprint"
- fi
-}
-
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-
-ynh_app_config_validate() {
- _ynh_app_config_validate
-
- if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[free_footprint]}" == "true" ]; then
- # If fpm_footprint is set to 'specific', use $free_footprint value.
- if [ "$fpm_footprint" = "specific" ]
- then
- fpm_footprint=$free_footprint
- fi
-
- if [ "$fpm_footprint" == "0" ]
- then
- ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
-
- exit 0
- fi
- fi
-}
-
-ynh_app_config_apply() {
- _ynh_app_config_apply
-
- ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
-}
-
-ynh_app_config_run $1
diff --git a/scripts/install b/scripts/install
index 0a683e5..8730626 100644
--- a/scripts/install
+++ b/scripts/install
@@ -1,14 +1,10 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
+ynh_app_setting_set --key=php_upload_max_filesize --value=256M
+
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
@@ -20,41 +16,41 @@ src_version=$(ynh_app_upstream_version)
# STORE SETTINGS FROM MANIFEST
#=================================================
-ynh_app_setting_set --app=$app --key=src_version --value=$src_version
+ynh_app_setting_set --key=src_version --value=$src_version
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
-ynh_script_progression --message="Setting up source files..." --weight=3
+ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/git_src"
ln -s $install_dir/git_src/public_html $install_dir/www
-chmod -R o-rwx "$install_dir"
-chown -R $app:www-data "$install_dir"
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
find $install_dir/www -type d -exec chmod 755 {} \;
find $install_dir/www -type f -exec chmod 644 {} \;
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
-ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
+ynh_script_progression "Configuring PHP-FPM..."
# Create a dedicated PHP-FPM config
-ynh_add_fpm_config
+ynh_config_add_phpfpm
# Create a dedicated NGINX config
-ynh_add_nginx_config
+ynh_config_add_nginx
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL APP
#=================================================
-ynh_script_progression --message="Installing app..." --weight=2
+ynh_script_progression "Installing app..."
-php$phpversion $install_dir/www/install/cli_install.php install \
+php$php_version $install_dir/www/install/cli_install.php install \
--db_host=localhost \
--db_user=$db_name \
--db_password=$db_pwd \
@@ -67,11 +63,11 @@ php$phpversion $install_dir/www/install/cli_install.php install \
--email=$email \
--http_server=https://$domain
-ynh_secure_remove $install_dir/www/install
+ynh_safe_rm $install_dir/www/install
-chmod 750 "$install_dir"
-chmod -R o-rwx "$install_dir"
-chown -R $app:www-data "$install_dir"
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
find $install_dir/www -type d -exec chmod 755 {} \;
find $install_dir/www -type f -exec chmod 644 {} \;
@@ -79,4 +75,4 @@ find $install_dir/www -type f -exec chmod 644 {} \;
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Installation of $app completed" --last
+ynh_script_progression "Installation of $app completed"
diff --git a/scripts/remove b/scripts/remove
index 4fb7e3c..0201b35 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -1,27 +1,21 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
-ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
+ynh_script_progression "Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
-ynh_remove_nginx_config
+ynh_config_remove_nginx
# Remove the dedicated PHP-FPM config
-ynh_remove_fpm_config
+ynh_config_remove_phpfpm
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Removal of $app completed" --last
+ynh_script_progression "Removal of $app completed"
diff --git a/scripts/restore b/scripts/restore
index d18bc98..f1a4bd9 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -1,11 +1,5 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@@ -13,43 +7,41 @@ source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
-ynh_script_progression --message="Restoring the app main directory..." --weight=1
+ynh_script_progression "Restoring the app main directory..."
-ynh_restore_file --origin_path="$install_dir"
+ynh_restore "$install_dir"
-chmod -R o-rwx "$install_dir"
-chown -R $app:www-data "$install_dir"
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
find $install_dir/www -type d -exec chmod 755 {} \;
find $install_dir/www -type f -exec chmod 644 {} \;
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
-ynh_script_progression --message="Restoring the MySQL database..." --weight=1
+ynh_script_progression "Restoring the MySQL database..."
-ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
+ynh_mysql_db_shell < ./db.sql
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
+ynh_script_progression "Restoring system configurations related to $app..."
-ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
+ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
-ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
+ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
-#=================================================
-# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
-ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
+ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
-ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
-ynh_systemd_action --service_name=nginx --action=reload
+ynh_systemctl --service=php$php_version-fpm --action=reload
+ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Restoration completed for $app" --last
+ynh_script_progression "Restoration completed for $app"
diff --git a/scripts/upgrade b/scripts/upgrade
index 4aaf2ed..f2478f6 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -1,64 +1,58 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
+ynh_app_setting_set_default --key=php_upload_max_filesize --value=256M
+
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
-ynh_script_progression --message="Upgrading source files..." --weight=1
+ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/git_src"
-ynh_secure_remove $install_dir/www/install
+ynh_safe_rm $install_dir/www/install
-chmod 750 "$install_dir"
-chmod -R o-rwx "$install_dir"
-chown -R $app:www-data "$install_dir"
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
+#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
find $install_dir/www -type d -exec chmod 755 {} \;
find $install_dir/www -type f -exec chmod 644 {} \;
-ynh_secure_remove --file="$install_dir/www/public_html"
+ynh_safe_rm "$install_dir/www/public_html"
ln -s $install_dir/git_src/public_html $install_dir/www
#=================================================
# UPDATE A CONFIG FILE
#=================================================
-ynh_script_progression --message="Updating $app's configuration files..." --weight=1
+ynh_script_progression "Updating $app's configuration files..."
# Create a dedicated PHP-FPM config
-ynh_add_fpm_config
+ynh_config_add_phpfpm
# Create a dedicated NGINX config
-ynh_add_nginx_config
+ynh_config_add_nginx
-#=================================================
-# SPECIFIC UPGRADE
#=================================================
# UPGRADE MYSQL CONFIGURATION
#=================================================
-ynh_script_progression --message="Upgrading MySQL configuration..." --weight=1
+ynh_script_progression "Upgrading MySQL configuration..."
# Update MySQL entries
-upgrade_mysql_dir="../sources/patches/mysql/from_$src_version.sql"
+upgrade_mysql_dir="../patches/mysql/from_$src_version.sql"
if [ -f "$upgrade_mysql_dir" ]; then
- ynh_mysql_execute_file_as_root --file=$upgrade_mysql_dir --database=$db_name
+ ynh_mysql_db_shell < "$upgrade_mysql_dir"
cat $upgrade_mysql_dir
fi
updated_src_version=$(ynh_app_upstream_version)
-ynh_app_setting_set --app=$app --key=src_version --value=$updated_src_version
+ynh_app_setting_set --key=src_version --value=$updated_src_version
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Upgrade of $app completed" --last
+ynh_script_progression "Upgrade of $app completed"
diff --git a/sources/patches/mysql/from_1.3.1.sql b/sources/patches/mysql/from_1.3.1.sql
deleted file mode 100644
index 34bc656..0000000
--- a/sources/patches/mysql/from_1.3.1.sql
+++ /dev/null
@@ -1,11 +0,0 @@
--- Extracted from abantecart_1.3.2_upgrade_only.tar.gz
--- Upstream 1.3.1 >> 1.3.2
--- Yunohost 1.3.1~ynh1 >> 1.3.2~ynh1
-
-ALTER TABLE `ac_order_products`
-ADD COLUMN `weight` DECIMAL(15,4) NOT NULL DEFAULT 0.0 AFTER `cost`,
-ADD COLUMN `weight_iso_code` VARCHAR(5) NOT NULL DEFAULT '' AFTER `weight`,
-ADD COLUMN `width` DECIMAL(15,4) NOT NULL DEFAULT 0 AFTER `weight_iso_code`,
-ADD COLUMN `length` DECIMAL(15,4) NOT NULL DEFAULT 0 AFTER `width`,
-ADD COLUMN `height` DECIMAL(15,4) NOT NULL DEFAULT 0 AFTER `length`,
-ADD COLUMN `length_iso_code` VARCHAR(5) NOT NULL DEFAULT '' AFTER `height`;