diff --git a/README.md b/README.md index 07110c3..dda4acf 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Kimai2 for YunoHost -[![Integration level](https://dash.yunohost.org/integration/kimai2.svg)](https://dash.yunohost.org/appci/app/kimai2) ![](https://ci-apps.yunohost.org/ci/badges/kimai2.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/kimai2.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/kimai2.svg)](https://dash.yunohost.org/appci/app/kimai2) ![Working status](https://ci-apps.yunohost.org/ci/badges/kimai2.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/kimai2.maintain.svg) [![Install Kimai2 with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=kimai2) *[Lire ce readme en français.](./README_fr.md)* @@ -20,13 +20,13 @@ This is the reloaded version of the open source timetracker Kimai. Right now its Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic ideas of time-tracking and the current development team. It is based on a lot of great frameworks. Special thanks to Symfony v4, Doctrine, AdminThemeBundle (based on AdminLTE). -**Shipped version:** 1.17.1~ynh1 +**Shipped version:** 1.20.2~ynh1 **Demo:** https://www.kimai.org/demo/ ## Screenshots -![](./doc/screenshots/screenshot1.png) +![Screenshot of Kimai2](./doc/screenshots/screenshot1.png) ## Disclaimers / important information @@ -47,21 +47,22 @@ Those roles are directly managed using YunoHost permission system. User choosen ## Documentation and resources -* Official app website: https://www.kimai.org -* Official admin documentation: https://www.kimai.org/documentation/ -* Upstream app code repository: https://github.com/kevinpapst/kimai2 -* YunoHost documentation for this app: https://yunohost.org/app_kimai2 -* Report a bug: https://github.com/YunoHost-Apps/kimai2_ynh/issues +* Official app website: +* Official admin documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/kimai2_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/kimai2_ynh/tree/testing --debug or sudo yunohost app upgrade kimai2 -u https://github.com/YunoHost-Apps/kimai2_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index b873101..e3a69ff 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,10 +1,14 @@ + + # Kimai2 pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/kimai2.svg)](https://dash.yunohost.org/appci/app/kimai2) ![](https://ci-apps.yunohost.org/ci/badges/kimai2.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/kimai2.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/kimai2.svg)](https://dash.yunohost.org/appci/app/kimai2) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/kimai2.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/kimai2.maintain.svg) [![Installer Kimai2 avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=kimai2) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer Kimai2 rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* @@ -16,13 +20,13 @@ This is the reloaded version of the open source timetracker Kimai. Right now its Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic ideas of time-tracking and the current development team. It is based on a lot of great frameworks. Special thanks to Symfony v4, Doctrine, AdminThemeBundle (based on AdminLTE). -**Version incluse :** 1.17.1~ynh1 +**Version incluse :** 1.20.2~ynh1 **Démo :** https://www.kimai.org/demo/ ## Captures d'écran -![](./doc/screenshots/screenshot1.png) +![Capture d'écran de Kimai2](./doc/screenshots/screenshot1.png) ## Avertissements / informations importantes @@ -43,21 +47,22 @@ Those roles are directly managed using YunoHost permission system. User choosen ## Documentations et ressources -* Site officiel de l'app : https://www.kimai.org -* Documentation officielle de l'admin : https://www.kimai.org/documentation/ -* Dépôt de code officiel de l'app : https://github.com/kevinpapst/kimai2 -* Documentation YunoHost pour cette app : https://yunohost.org/app_kimai2 -* Signaler un bug : https://github.com/YunoHost-Apps/kimai2_ynh/issues +* Site officiel de l'app : +* Documentation officielle de l'admin : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/kimai2_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/kimai2_ynh/tree/testing --debug ou sudo yunohost app upgrade kimai2 -u https://github.com/YunoHost-Apps/kimai2_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** diff --git a/check_process b/check_process index f514ce4..5f71e08 100644 --- a/check_process +++ b/check_process @@ -1,8 +1,8 @@ ;; Test complet mysql ; Manifest domain="domain.tld" - admin="john" is_public=1 + admin="john" database="mysql" registration=1 ; Checks @@ -13,10 +13,8 @@ setup_private=1 setup_public=1 upgrade=1 - # 1.9~ynh1 - upgrade=1 from_commit=22580412fae14859f661c1f9b54a3131a60c9323 - # 1.11.1~ynh1 - upgrade=1 from_commit=f26285511a167a1ed591a7fa96ae786ea89efb1e + # 1.17.1~ynh1 + upgrade=1 from_commit=6b3ab38a5bf6aa48aaef23254381e8063839598b backup_restore=1 multi_instance=1 port_already_use=0 @@ -24,8 +22,8 @@ ;; Test complet sqlite ; Manifest domain="domain.tld" - admin="john" is_public=1 + admin="john" database="sqlite" registration=1 ; Checks @@ -36,10 +34,8 @@ setup_private=1 setup_public=1 upgrade=1 - # 1.9~ynh1 - upgrade=1 from_commit=22580412fae14859f661c1f9b54a3131a60c9323 - # 1.11.1~ynh1 - upgrade=1 from_commit=f26285511a167a1ed591a7fa96ae786ea89efb1e + # 1.17.1~ynh1 + upgrade=1 from_commit=6b3ab38a5bf6aa48aaef23254381e8063839598b backup_restore=1 multi_instance=1 port_already_use=0 @@ -47,8 +43,3 @@ ;;; Options Email=anmol@datamol.org Notification=change -;;; Upgrade options - ; commit=22580412fae14859f661c1f9b54a3131a60c9323 - name=1.9~ynh1 - ; commit=f26285511a167a1ed591a7fa96ae786ea89efb1e - name=1.11.1~ynh1 diff --git a/conf/.env.mysql b/conf/.env.mysql index 2a53aaf..30b9315 100644 --- a/conf/.env.mysql +++ b/conf/.env.mysql @@ -1,36 +1,21 @@ -# This file is a "template" of which env vars need to be defined for your application -# Copy this file to .env file for development, create environment variables when deploying to production -# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration +# Configure your database connection and set the correct server version: +# for MySQL "serverVersion=5.7" and for MariaDB "serverVersion=mariadb-10.5.8" +DATABASE_URL=mysql://__DB_USER__:__DB_PWD__@127.0.0.1:3306/__DB_NAME__?charset=utf8&serverVersion=mariadb-10.5.12 -###> symfony/framework-bundle ### -APP_ENV=prod -APP_SECRET=__RANDOM_KEY__ -#TRUSTED_PROXIES=127.0.0.1,127.0.0.2 -#TRUSTED_HOSTS=localhost,example.com -###< symfony/framework-bundle ### - -###> doctrine/doctrine-bundle ### -# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url -# For a MySQL database, use: "mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=10.2.12&charset=utf8" -# For a MariaDB database, use: "mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=mariadb-10.2.12" -# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data/kimai.sqlite" -# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml -DATABASE_URL=mysql://__DB_USER__:__DB_PWD__@127.0.0.1:3306/__DB_NAME__ -# DATABASE_URL=sqlite:///%kernel.project_dir%/var/data/kimai.sqlite -###< doctrine/doctrine-bundle ### - -###> nelmio/cors-bundle ### -CORS_ALLOW_ORIGIN=^https?://localhost(:[0-9]+)?$ -###< nelmio/cors-bundle ### - -### Email configuration -# SMTP: smtp://localhost:25?encryption=&auth_mode= -# Google: gmail://username:password@default -# Amazon: ses://ACCESS_KEY:SECRET_KEY@default?region=eu-west-1 -# Mailchimp: mandrill://KEY@default -# Mailgun: mailgun://KEY:DOMAIN@default -# Postmark: postmark://ID@default -# Sendgrid: sendgrid://KEY@default -# Disable emails: null://null -MAILER_URL=smtp://localhost:25?encryption=&auth_mode= +# Email will be sent with this address as sender MAILER_FROM=admin@__DOMAIN__ +# Email connection (disabled by default) more info at https://www.kimai.org/documentation/emails.html +MAILER_URL=smtp://localhost:25?encryption=&auth_mode= + +# do not change, unless you are developing for Kimai +APP_ENV=prod + +# should be changed to a unique character sequence +APP_SECRET=__RANDOM_KEY__ + +# unlikely, that you need to change this one +CORS_ALLOW_ORIGIN=^https?://localhost(:[0-9]+)?$ + +# Running behind reverse proxies? Use those: +TRUSTED_PROXIES=127.0.0.1 +TRUSTED_HOSTS=localhost,__DOMAIN__ diff --git a/conf/.env.sqlite b/conf/.env.sqlite index c708414..46d4606 100644 --- a/conf/.env.sqlite +++ b/conf/.env.sqlite @@ -1,36 +1,21 @@ -# This file is a "template" of which env vars need to be defined for your application -# Copy this file to .env file for development, create environment variables when deploying to production -# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration - -###> symfony/framework-bundle ### -APP_ENV=prod -APP_SECRET=__RANDOM_KEY__ -#TRUSTED_PROXIES=127.0.0.1,127.0.0.2 -#TRUSTED_HOSTS=localhost,example.com -###< symfony/framework-bundle ### - -###> doctrine/doctrine-bundle ### -# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url -# For a MySQL database, use: "mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=10.2.12&charset=utf8" -# For a MariaDB database, use: "mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=mariadb-10.2.12" -# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data/kimai.sqlite" -# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml -# DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name +# Configure your database connection and set the correct server version: +# for MySQL "serverVersion=5.7" and for MariaDB "serverVersion=mariadb-10.5.8" DATABASE_URL=sqlite:///%kernel.project_dir%/var/data/kimai.sqlite -###< doctrine/doctrine-bundle ### -###> nelmio/cors-bundle ### -CORS_ALLOW_ORIGIN=^https?://localhost(:[0-9]+)?$ -###< nelmio/cors-bundle ### - -### Email configuration -# SMTP: smtp://localhost:25?encryption=&auth_mode= -# Google: gmail://username:password@default -# Amazon: ses://ACCESS_KEY:SECRET_KEY@default?region=eu-west-1 -# Mailchimp: mandrill://KEY@default -# Mailgun: mailgun://KEY:DOMAIN@default -# Postmark: postmark://ID@default -# Sendgrid: sendgrid://KEY@default -# Disable emails: null://null -MAILER_URL=smtp://localhost:25?encryption=&auth_mode= +# Email will be sent with this address as sender MAILER_FROM=admin@__DOMAIN__ +# Email connection (disabled by default) more info at https://www.kimai.org/documentation/emails.html +MAILER_URL=smtp://localhost:25?encryption=&auth_mode= + +# do not change, unless you are developing for Kimai +APP_ENV=prod + +# should be changed to a unique character sequence +APP_SECRET=__RANDOM_KEY__ + +# unlikely, that you need to change this one +CORS_ALLOW_ORIGIN=^https?://localhost(:[0-9]+)?$ + +# Running behind reverse proxies? Use those: +TRUSTED_PROXIES=127.0.0.1 +TRUSTED_HOSTS=localhost,__DOMAIN__ diff --git a/conf/local.yaml b/conf/local.yaml index 797cf81..8bd091a 100644 --- a/conf/local.yaml +++ b/conf/local.yaml @@ -10,6 +10,7 @@ kimai: user: registration: __REGISTRATION__ ldap: + activate: true # more infos about the connection params can be found at: # https://docs.laminas.dev/laminas-ldap/api/ connection: @@ -17,11 +18,11 @@ kimai: # You can connect to multiple servers by setting their URLs like this: # host: "ldap://ldap.example.local ldap://ldap2.example.local" # host: "ldaps://ldap.example.local ldaps://ldap2.example.local" - host: 127.0.0.1 + host: "ldap://127.0.0.1" # Default port for your LDAP port server # default: 389 - #port: 389 + port: 389 # Whether or not the LDAP client should use SSL encrypted transport. # The useSsl and useStartTls options are mutually exclusive. @@ -80,20 +81,20 @@ kimai: user: # baseDn to query for users (mandatory setting). - baseDn: ou=users, dc=yunohost, dc=org + baseDn: "ou=users, dc=yunohost, dc=org" # Field used to match the login username in your LDAP. # If "bindRequiresDn: false" is set, the username is used in "bind". # Otherwise a search is executed to find the users "dn" by finding the user # via this attribute with his "baseDn" and the "filter" below. # default: uid - usernameAttribute: uid + usernameAttribute: "uid" # LDAP search base filter to find the user / the users DN. # Do NOT include the rule (&(usernameAttribute=%s)), it will be appended # automatically. The result of the search filter must return 1 result only. # default: empty (results in (&(uid=%s)) with default usernameAttribute) - filter: (&(objectClass=inetOrgPerson)) + filter: "(&(objectClass=inetOrgPerson))" # LDAP search base filter to find the user attributes. # This is used for a slightly different query than the one above, which is @@ -109,12 +110,12 @@ kimai: attributes: # The following 2 rules are automatically prepended and can be overwritten. # Username is set to the value of the configured "usernameAttribute" field - - { ldap_attr: "usernameAttribute", user_method: setUsername } + - { ldap_attr: "uid", user_method: setUsername } # Only applied if you don't configure a mapping for setEmail() - - { ldap_attr: mail, user_method: setEmail } + - { ldap_attr: "mail", user_method: setEmail } # An example which will set the display name in Kimai from the # value of the "common name" field in your LDAP - - { ldap_attr: cn, user_method: setAlias } + - { ldap_attr: "cn", user_method: setAlias } # You can comment the following section, if you don't want to manage # user roles in Kimai via LDAP groups. If you want to use the group @@ -123,7 +124,7 @@ kimai: role: # baseDn to query for groups, MUST be set to activate the "group import" # default: empty (deactivated) - baseDn: ou=permission, dc=yunohost, dc=org + baseDn: "ou=permission, dc=yunohost, dc=org" # Filter to query user groups, all results will be matched against # the configured "groups" mapping below. @@ -132,24 +133,24 @@ kimai: # The following example rule will be expanded to (for user "foo"): # (&(&(objectClass=groupOfNames))(member=foo)) # default: empty - filter: (&(objectClass=posixGroup)(cn=__APP__*)) - + filter: "(&(objectClass=posixGroup)(cn=__APP__*))" + # The following field is taken from the LDAP user entry and its # value is used in the filter above as "valueOfUsernameAttribute". # The attribute must be given in lowercase! # The example below uses "posix group style memberUid". # default: dn - usernameAttribute: dn + usernameAttribute: "dn" # Field that holds the group name, which will be used to map the # LDAP groups with Kimai roles (see groups mapping below). # default: cn - nameAttribute: cn + nameAttribute: "cn" # Field that holds the users dn in your LDAP group definition. # Value of this configuration is used in the filter (see above). # default: member - userDnAttribute: inheritPermission + userDnAttribute: "inheritPermission" # Convert LDAP group name (nameAttribute) to Kimai role # You will very likely have to define mappings, unless your groups diff --git a/conf/mysql.src b/conf/mysql.src index 7d4af67..f652536 100644 --- a/conf/mysql.src +++ b/conf/mysql.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.17.1.tar.gz -SOURCE_SUM=ceff0573591d2e5c70a679301caabe626d8545af5e987443c8155f633babcd0e +SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.20.2.tar.gz +SOURCE_SUM=0057fd63fedfbf06d699536c1bd7614a8296c158eef0ca19831ec97ca20a46cb SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/nginx.conf b/conf/nginx.conf index d219fe5..8c7ad9e 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -3,9 +3,6 @@ root __FINALPATH__/public/ ; location __PATH__/ { - # Path to source - # alias __FINALPATH__/public/ ; - index index.php; # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file diff --git a/manifest.json b/manifest.json index ee19fb3..abfe252 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ "de": "Eine web-basierte Mehrbenutzer-Zeiterfassung mit Rechnungsdruck mit Unterstützung für mobile Endgeräte", "cs": "Víceuživatelská webová aplikace pro sledování času s podporou mobilních zařízení" }, - "version": "1.17.1~ynh1", + "version": "1.20.2~ynh1", "url": "https://www.kimai.org", "upstream": { "license": "MIT", @@ -38,10 +38,6 @@ "name": "domain", "type": "domain" }, - { - "name": "admin", - "type": "user" - }, { "name": "is_public", "type": "boolean", @@ -53,6 +49,10 @@ }, "default": false }, + { + "name": "admin", + "type": "user" + }, { "name": "registration", "type": "boolean", diff --git a/scripts/_common.sh b/scripts/_common.sh index c6f97cf..03c86de 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,13 +5,9 @@ #================================================= # dependencies used by the app -pkg_dependencies="" - -YNH_PHP_VERSION="7.3" - -YNH_COMPOSER_VERSION="2.0.4" - -extra_php_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-pdo php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-xsl php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-sqlite3" +YNH_PHP_VERSION="7.4" +pkg_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-pdo php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-xsl php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-sqlite3" +YNH_COMPOSER_VERSION="2.3.3" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index 5b33202..50e3475 100755 --- a/scripts/install +++ b/scripts/install @@ -25,11 +25,11 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" -admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC +admin=$YNH_APP_ARG_ADMIN registration=$YNH_APP_ARG_REGISTRATION database="mysql" -random_key=$(ynh_string_random 32) +random_key=$(ynh_string_random --length=32) app=$YNH_APP_INSTANCE_NAME @@ -71,7 +71,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # CREATE A MYSQL DATABASE @@ -100,6 +100,15 @@ chown -R $app:www-data "$final_path" setfacl -dR -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/" setfacl -R -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/" +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring PHP-FPM..." + +# Create a dedicated PHP-FPM config +ynh_add_fpm_config +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + #================================================= # NGINX CONFIGURATION #================================================= @@ -108,15 +117,6 @@ ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring PHP-FPM..." - -# Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - #================================================= # SPECIFIC SETUP #================================================= diff --git a/scripts/restore b/scripts/restore index b23f90e..e852b04 100755 --- a/scripts/restore +++ b/scripts/restore @@ -45,13 +45,6 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -73,18 +66,6 @@ chown -R $app:www-data "$final_path" setfacl -dR -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/" setfacl -R -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/" -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." - -# Restore the file first, so it can have a backup if different -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -# Recreate a dedicated php-fpm config -ynh_add_fpm_config --package="$extra_php_dependencies" -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - #================================================= # SPECIFIC RESTORATION #================================================= @@ -95,6 +76,20 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the PHP-FPM configuration..." + +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # RESTORE THE MYSQL DATABASE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 9205484..3a28f39 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -34,6 +34,17 @@ ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) +if [ "$database" == "sqlite" ] +then + ynh_script_progression --message="Sqlite is not more supported by Kimai2..." + ynh_script_progression --message="Kimai2 will be upgrade to last available version : 1.13" + if ynh_compare_current_package_version --comparison ge --version 1.17.1~ynh1 + then + ynh_script_progression --message="Kimai2 sqlite version is already to the last available version, no upgrade will be made" + ynh_die "" 0 + fi +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -80,13 +91,18 @@ if ! ynh_permission_exists --permission="super_admin"; then ynh_permission_create --permission="super_admin" --allowed="$admin" fi +if [ -z "$registration" ]; then + registration_enabled="false" + ynh_app_setting_set --app=$app --key=registration --value=$registration +fi + #================================================= # CREATE DEDICATED USER #================================================= ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -95,36 +111,9 @@ ynh_system_user_create --username=$app --home_dir=$final_path if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." - - # Create a temporary directory and backup config - tmpdir="$(mktemp -d)" - if [ -f $final_path/config/packages/local.yaml ]; then - cp -af "$final_path/config/packages/local.yaml" "$tmpdir/." - fi - if [ -d $final_path/var/invoices ]; then - cp -af "$final_path/var/invoices" "$tmpdir/." - fi - if [ -d $final_path/var/data ]; then - cp -af "$final_path/var/data" "$tmpdir/." - fi - - ynh_secure_remove --file="$final_path" - + # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --source_id="$database" - - # Restore config - if [ -f $tmpdir/local.yaml ]; then - cp -af "$tmpdir/local.yaml" "$final_path/config/packages/." - fi - if [ -d $tmpdir/invoices ]; then - cp -af "$tmpdir/invoices" "$final_path/var/." - fi - if [ -d $tmpdir/data ]; then - cp -af "$tmpdir/data" "$final_path/var/." - fi - - ynh_secure_remove --file="$tmpdir" + ynh_setup_source --dest_dir="$final_path" --source_id="$database" --keep="config/packages/local.yaml var/invoices/ var/data/" fi chmod 750 "$final_path" @@ -133,14 +122,6 @@ chown -R $app:www-data "$final_path" setfacl -dR -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/" setfacl -R -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -154,9 +135,17 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Upgrading PHP-FPM configuration..." # Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC UPGRADE #=================================================