diff --git a/README.md b/README.md
index c4cee08..f9d67d9 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Create and email invoices, track payments, expenses, and time tasks
-**Shipped version:** 5.3.60~ynh1
+**Shipped version:** 5.5.2~ynh1
**Demo:** https://app.invoiceninja.com/dashboard
diff --git a/README_fr.md b/README_fr.md
index 12e2727..131a22a 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Créer et envoyer des factures par e-mail, suivre les paiements, les dépenses et les tâches horaires
-**Version incluse :** 5.3.60~ynh1
+**Version incluse :** 5.5.2~ynh1
**Démo :** https://app.invoiceninja.com/dashboard
diff --git a/conf/app.src b/conf/app.src
index 59e1e34..955244d 100644
--- a/conf/app.src
+++ b/conf/app.src
@@ -1,5 +1,5 @@
-SOURCE_URL=https://github.com/invoiceninja/invoiceninja/releases/download/v5.3.60/invoiceninja.zip
-SOURCE_SUM=7c1fc193a6bcca35a6af684694418836baec8e16049fd251ff68837a0d6ce4d2
+SOURCE_URL=https://github.com/invoiceninja/invoiceninja/releases/download/v5.5.2/invoiceninja.zip
+SOURCE_SUM=64647f6960b64ac42633b65c6b8c108544e2dc845117d3c9f921792474df4ef9
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=false
diff --git a/conf/msg_install b/conf/msg_install
new file mode 100644
index 0000000..9fdf963
--- /dev/null
+++ b/conf/msg_install
@@ -0,0 +1,12 @@
+__APP__ was successfully installed :)
+
+Please open your __APP__ domain: https://__DOMAIN____PATH_URL__
+
+The username is: __EMAIL__
+The password is the administrator one you filled during the installation
+The secret is: __API_SECRET__
+
+Please note that if you did NOT install the application in public mode, you should go to the Yunohost login portal first to authenticate yourself in order to access to the application.
+
+If you are facing any problems, head to the forums: https://forum.yunohost.org/
+If you want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/invoiceninja5_ynh/issues
diff --git a/manifest.json b/manifest.json
index a6f96bb..a03e68a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -6,7 +6,7 @@
"en": "Create and email invoices, track payments, expenses, and time tasks",
"fr": "Créer et envoyer des factures par e-mail, suivre les paiements, les dépenses et les tâches horaires"
},
- "version": "5.3.60~ynh1",
+ "version": "5.5.2~ynh1",
"url": "https://invoiceninja.org",
"upstream": {
"license": "Elastic-2.0",
@@ -31,7 +31,7 @@
"mysql"
],
"arguments": {
- "install" : [
+ "install": [
{
"name": "domain",
"type": "domain"
@@ -47,17 +47,20 @@
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
- "choices": ["fr", "en"],
+ "choices": [
+ "fr",
+ "en"
+ ],
"default": "en"
},
{
"name": "is_public",
"type": "boolean",
"default": true,
- "help": {
- "en": "Since your clients should have the possibility to access your invoices, the app is public. If you only want to send invoices via mail (or not at all), deactivate public access",
+ "help": {
+ "en": "Since your clients should have the possibility to access your invoices, the app is public. If you only want to send invoices via mail (or not at all), deactivate public access",
"fr": "Puisque vos clients doivent avoir la possibilité d'accéder à vos factures, l'application est publique. Si vous souhaitez uniquement envoyer des factures par courrier (ou pas du tout), désactivez l'accès public"
- }
+ }
},
{
"name": "password",
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 11d5a5f..0837b20 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -4,11 +4,11 @@
# COMMON VARIABLES
#=================================================
-YNH_PHP_VERSION="7.4"
+YNH_PHP_VERSION="8.1"
# dependencies used by the app
-pkg_dependencies="php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-fileinfo php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-pdo php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql libnss3-dev libatk1.0-0 libatk-bridge2.0-0 libxcomposite1 libxrandr2 libasound2 libgbm1"
+pkg_dependencies="php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-fileinfo php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-pdo php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql libnss3-dev libatk1.0-0 libatk-bridge2.0-0 libxcomposite1 libxrandr2 libasound2"
#=================================================
# PERSONAL HELPERS
diff --git a/scripts/install b/scripts/install
index f1b0c19..a342c19 100755
--- a/scripts/install
+++ b/scripts/install
@@ -6,6 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
+source ynh_send_readme_to_admin__2
source _common.sh
source /usr/share/yunohost/helpers
@@ -182,6 +183,13 @@ ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
+#=================================================
+# SEND A README FOR THE ADMIN
+#=================================================
+ynh_script_progression --message="Sending a readme for the admin..."
+
+ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$email --type='install'
+
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/upgrade b/scripts/upgrade
index cb7e9e3..0d98727 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -21,7 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
-phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
+phpversion=$YNH_PHP_VERSION
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
@@ -131,17 +131,27 @@ fi
ynh_script_progression --message="Upgrading the database..."
pushd "$final_path"
- # Put the application into maintenance mode
- php$phpversion artisan down --no-interaction --verbose
+ # Clear caches
+ # https://github.com/invoiceninja/invoiceninja/issues/7397
+ ynh_secure_remove --file=$final_path/bootstrap/cache/
+ ynh_secure_remove --file=$final_path/storage/framework/cache/
+ ynh_secure_remove --file=$final_path/storage/framework/sessions/
- # Optimize the framework for better performance
- php$phpversion artisan optimize --no-interaction --verbose
+ mkdir -p $final_path/bootstrap/cache/ $final_path/storage/framework/cache/ $final_path/storage/framework/sessions/
+
+ # clear cached stuff under /app/data/storage/framework (https://github.com/laravel/framework/issues/17377)
+ php$phpversion artisan view:clear
+ php$phpversion artisan cache:clear
# Run the database migrations
php$phpversion artisan migrate --force --no-interaction --verbose
- # Bring the application out of maintenance mode
- php$phpversion artisan up --no-interaction --verbose
+ # Optimize the framework for better performance
+ php$phpversion artisan optimize --no-interaction --verbose
+
+ # clear cached stuff under /app/data/storage/framework (https://github.com/laravel/framework/issues/17377)
+ php$phpversion artisan view:clear
+ php$phpversion artisan cache:clear
popd
chmod 750 "$final_path"
diff --git a/scripts/ynh_send_readme_to_admin__2 b/scripts/ynh_send_readme_to_admin__2
new file mode 100644
index 0000000..f1e53ec
--- /dev/null
+++ b/scripts/ynh_send_readme_to_admin__2
@@ -0,0 +1,129 @@
+#!/bin/bash
+
+# Send an email to inform the administrator
+#
+# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
+# | arg: -m --app_message= - The file with the content to send to the administrator.
+# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
+# example: "root admin@domain"
+# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
+# example: "root admin@domain user1 user2"
+# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade'
+#
+# Requires YunoHost version 4.1.0 or higher.
+ynh_send_readme_to_admin() {
+ # Declare an array to define the options of this helper.
+ declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= )
+ local app_message
+ local recipients
+ local type
+ # Manage arguments with getopts
+
+ ynh_handle_getopts_args "$@"
+ app_message="${app_message:-}"
+ recipients="${recipients:-root}"
+ type="${type:-install}"
+
+ # Get the value of admin_mail_html
+ admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
+ admin_mail_html="${admin_mail_html:-0}"
+
+ # Retrieve the email of users
+ find_mails () {
+ local list_mails="$1"
+ local mail
+ local recipients=" "
+ # Read each mail in argument
+ for mail in $list_mails
+ do
+ # Keep root or a real email address as it is
+ if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
+ then
+ recipients="$recipients $mail"
+ else
+ # But replace an user name without a domain after by its email
+ if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
+ then
+ recipients="$recipients $mail"
+ fi
+ fi
+ done
+ echo "$recipients"
+ }
+ recipients=$(find_mails "$recipients")
+
+ # Subject base
+ local mail_subject="\`$app\`"
+
+ # Adapt the subject according to the type of mail required.
+ if [ "$type" = "backup" ]; then
+ mail_subject="$mail_subject has just been backup."
+ elif [ "$type" = "change_url" ]; then
+ mail_subject="$mail_subject has just been moved to a new URL!"
+ elif [ "$type" = "remove" ]; then
+ mail_subject="$mail_subject has just been removed!"
+ elif [ "$type" = "restore" ]; then
+ mail_subject="$mail_subject has just been restored!"
+ elif [ "$type" = "upgrade" ]; then
+ mail_subject="$mail_subject has just been upgraded!"
+ else # install
+ mail_subject="$mail_subject has just been installed!"
+ fi
+
+ ynh_add_config --template="$app_message" --destination="../conf/msg__to_send"
+
+ ynh_delete_file_checksum --file="../conf/msg__to_send"
+
+ local mail_message="This is an automated message from your beloved YunoHost server.
+
+Specific information for the application $app.
+
+$(cat "../conf/msg__to_send")"
+
+ # Store the message into a file for further modifications.
+ echo "$mail_message" > mail_to_send
+
+ # If a html email is required. Apply html tags to the message.
+ if [ "$admin_mail_html" -eq 1 ]
+ then
+ # Insert 'br' tags at each ending of lines.
+ ynh_replace_string "$" "
" mail_to_send
+
+ # Insert starting HTML tags
+ sed --in-place '1s@^@\n\n