From 7faeb400159544bc81dbf070885a3c33abdee706 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 16:02:21 +0100 Subject: [PATCH 01/38] 1.18.2 --- conf/{.env.mysql => .env.example} | 0 conf/.env.sqlite | 36 ------------------ conf/app.src | 7 ++++ conf/mysql.src | 7 ---- conf/sqlite.src | 7 ---- manifest.json | 4 +- scripts/_common.sh | 9 ++--- scripts/backup | 7 +--- scripts/install | 23 +++++------- scripts/remove | 10 ++--- scripts/restore | 13 +++---- scripts/upgrade | 61 ++----------------------------- 12 files changed, 35 insertions(+), 149 deletions(-) rename conf/{.env.mysql => .env.example} (100%) delete mode 100644 conf/.env.sqlite create mode 100644 conf/app.src delete mode 100644 conf/mysql.src delete mode 100644 conf/sqlite.src diff --git a/conf/.env.mysql b/conf/.env.example similarity index 100% rename from conf/.env.mysql rename to conf/.env.example diff --git a/conf/.env.sqlite b/conf/.env.sqlite deleted file mode 100644 index c708414..0000000 --- a/conf/.env.sqlite +++ /dev/null @@ -1,36 +0,0 @@ -# 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 -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= -MAILER_FROM=admin@__DOMAIN__ diff --git a/conf/app.src b/conf/app.src new file mode 100644 index 0000000..2a2e81b --- /dev/null +++ b/conf/app.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.18.2.tar.gz +SOURCE_SUM=76e9f5fa19a6416d794c82419926adfadae365d838f46df7f8455ab9a4bc8849 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/mysql.src b/conf/mysql.src deleted file mode 100644 index 7d4af67..0000000 --- a/conf/mysql.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.17.1.tar.gz -SOURCE_SUM=ceff0573591d2e5c70a679301caabe626d8545af5e987443c8155f633babcd0e -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true diff --git a/conf/sqlite.src b/conf/sqlite.src deleted file mode 100644 index c78f915..0000000 --- a/conf/sqlite.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.13.tar.gz -SOURCE_SUM=caab9910a85b16772af678ee8519a8030cd8496aa94ce0a0027fffa6a91f3fef -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true \ No newline at end of file diff --git a/manifest.json b/manifest.json index ee19fb3..0e033f6 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.18.2~ynh1", "url": "https://www.kimai.org", "upstream": { "license": "MIT", @@ -29,7 +29,7 @@ "multi_instance": true, "services": [ "nginx", - "php7.3-fpm", + "php8.0-fpm", "mysql" ], "arguments": { diff --git a/scripts/_common.sh b/scripts/_common.sh index c6f97cf..fb8c438 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,14 +4,11 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="" +YNH_PHP_VERSION="8.0" -YNH_PHP_VERSION="7.3" +YNH_COMPOSER_VERSION="2.2.7" -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" +pkg_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl 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" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index c6aa4b6..86cad22 100755 --- a/scripts/backup +++ b/scripts/backup @@ -31,7 +31,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -database=$(ynh_app_setting_get --app=$app --key=database) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -59,11 +58,9 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= +ynh_print_info --message="Backing up the MySQL database..." -if [ "$database" = "mysql" ]; then - ynh_print_info --message="Backing up the MySQL database..." - ynh_mysql_dump_db --database="$db_name" > db.sql -fi +ynh_mysql_dump_db --database="$db_name" > db.sql #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 5b33202..02730cf 100755 --- a/scripts/install +++ b/scripts/install @@ -28,8 +28,8 @@ path_url="/" admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC registration=$YNH_APP_ARG_REGISTRATION -database="mysql" random_key=$(ynh_string_random 32) +phpversion=$YNH_PHP_VERSION app=$YNH_APP_INSTANCE_NAME @@ -53,7 +53,6 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=registration --value=$registration -ynh_app_setting_set --app=$app --key=database --value=$database ynh_app_setting_set --app=$app --key=random_key --value=$random_key #================================================= @@ -78,12 +77,10 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= ynh_script_progression --message="Creating a MySQL database..." -if [ "$database" = "mysql" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) - db_user=$db_name - ynh_app_setting_set --app=$app --key=db_name --value=$db_name - ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name -fi +db_name=$(ynh_sanitize_dbid --db_name=$app) +db_user=$db_name +ynh_app_setting_set --app=$app --key=db_name --value=$db_name +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -114,7 +111,7 @@ ynh_add_nginx_config ynh_script_progression --message="Configuring PHP-FPM..." # 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) #================================================= @@ -151,7 +148,7 @@ chmod 400 "$final_path/config/packages/local.yaml" chown $app:$app "$final_path/config/packages/local.yaml" # Configure environement -ynh_add_config --template="../conf/.env.$database" --destination="$final_path/.env" +ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env" chmod 400 "$final_path/.env" chown $app:$app "$final_path/.env" @@ -161,13 +158,13 @@ chown $app:$app "$final_path/.env" #================================================= ynh_script_progression --message="Installing Kimai2..." -update-alternatives --set php /usr/bin/php$phpversion +#update-alternatives --set php /usr/bin/php$phpversion pushd "$final_path" ynh_exec_as $app php$phpversion bin/console kimai:install -n popd -update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} +#update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} #================================================= # GENERIC FINALIZATION @@ -183,8 +180,6 @@ ynh_permission_create --permission="super_admin" --allowed "$admin" # Make app public if necessary if [ $is_public -eq 1 ] then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" fi diff --git a/scripts/remove b/scripts/remove index f5ea80d..9fb39ec 100755 --- a/scripts/remove +++ b/scripts/remove @@ -20,20 +20,16 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) -database=$(ynh_app_setting_get --app=$app --key=database) #================================================= # STANDARD REMOVE #================================================= # REMOVE THE MYSQL DATABASE #================================================= +ynh_script_progression --message="Removing the MySQL database..." -if [ "$database" = "mysql" ]; then - ynh_script_progression --message="Removing the MySQL database..." - - # Remove a database if it exists, along with the associated user - ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -fi +# Remove a database if it exists, along with the associated user +ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index b23f90e..171f473 100755 --- a/scripts/restore +++ b/scripts/restore @@ -33,7 +33,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -database=$(ynh_app_setting_get --app=$app --key=database) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -82,7 +81,7 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." 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" +ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= @@ -98,13 +97,11 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE MYSQL DATABASE #================================================= +ynh_script_progression --message="Restoring the MySQL database..." -if [ "$database" = "mysql" ]; then - ynh_script_progression --message="Restoring the MySQL database..." - db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) - ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql -fi +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 9205484..8c18576 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,13 +24,11 @@ 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) registration=$(ynh_app_setting_get --app=$app --key=registration) -database=$(ynh_app_setting_get --app=$app --key=database) random_key=$(ynh_app_setting_get --app=$app --key=random_key) #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -96,35 +94,8 @@ 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" --keep="$final_path/config/packages/local.yaml $final_path/var/invoices $final_path/var/data $final_path/.env" fi chmod 750 "$final_path" @@ -154,8 +125,7 @@ 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" -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +ynh_add_fpm_config #================================================= # SPECIFIC UPGRADE @@ -173,41 +143,18 @@ 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/" -#================================================= -# UPDATE A CONFIG FILE -#================================================= -ynh_script_progression --message="Updating a configuration file..." - -if [ $registration -eq 1 ] -then - registration="true" -else - registration="false" -fi - -ynh_add_config --template="../conf/local.yaml" --destination="$final_path/config/packages/local.yaml" - -chmod 400 "$final_path/config/packages/local.yaml" -chown $app:$app "$final_path/config/packages/local.yaml" - -# Configure environement -ynh_add_config --template="../conf/.env.$database" --destination="$final_path/.env" - -chmod 400 "$final_path/.env" -chown $app:$app "$final_path/.env" - #================================================= # INSTALL KIMAI2 #================================================= ynh_script_progression --message="Installing Kimai2..." -update-alternatives --set php /usr/bin/php$phpversion +#update-alternatives --set php /usr/bin/php$phpversion pushd "$final_path" ynh_exec_as $app php$phpversion bin/console kimai:update -n popd -update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} +#update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} #================================================= # GENERIC FINALIZATION From 390d056d3018989e0eb3c39c9ad50bfb4790fe13 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 12 Mar 2022 15:02:27 +0000 Subject: [PATCH 02/38] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 07110c3..c19b38d 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ 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.18.2~ynh1 **Demo:** https://www.kimai.org/demo/ diff --git a/README_fr.md b/README_fr.md index b873101..0c81eb2 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,7 +16,7 @@ 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.18.2~ynh1 **Démo :** https://www.kimai.org/demo/ From 395046176c0f70e06b47db77adeca43a1d5b8fd5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 16:03:07 +0100 Subject: [PATCH 03/38] Update manifest.json --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 0e033f6..9cd58a5 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "kimai2", "packaging_format": 1, "description": { - "en": "A multi-user application for time-tracking with support for mobile devices", - "fr": "Une application web de suivi du temps, multi-utilisateurs, et compatible avec les appareils mobiles", + "en": "Multi-user application for time-tracking with support for mobile devices", + "fr": "Application web de suivi du temps, multi-utilisateurs, et compatible avec les appareils mobiles", "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í" }, From 30f5b2cdb5edf67507798f81b22b0b87492159ac Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 16:07:58 +0100 Subject: [PATCH 04/38] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 02730cf..583a065 100755 --- a/scripts/install +++ b/scripts/install @@ -89,7 +89,7 @@ ynh_script_progression --message="Setting up source files..." 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 --dest_dir="$final_path" --source_id="$database" +ynh_setup_source --dest_dir="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" From e330d61649e8b637032524945eaf194d96e1b73c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 16:16:27 +0100 Subject: [PATCH 05/38] Fix --- conf/local.yaml | 28 ++++++++++++++-------------- doc/DISCLAIMER.md | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/conf/local.yaml b/conf/local.yaml index 797cf81..031dbc9 100644 --- a/conf/local.yaml +++ b/conf/local.yaml @@ -8,7 +8,7 @@ security: kimai_ldap: ~ kimai: user: - registration: __REGISTRATION__ + registration: "__REGISTRATION__" ldap: # more infos about the connection params can be found at: # https://docs.laminas.dev/laminas-ldap/api/ @@ -17,11 +17,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 +80,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 +109,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: "usernameAttribute", 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 +123,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 +132,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=posixAccount))(uid={{username}})(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))" # 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/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index a458f2b..59a4e84 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,11 +1,11 @@ * Require dedicated domain like **kimai.domain.tld**. * This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server) -* As sqlite support ended on version 1.14, if you choosed an sqlite databse during installation, Kimai2 upgrade is blocked to version 1.13 #### Multi-user support LDAP is supported HTTP auth is not supported + Defaul Kimai2 roles are: * ROLE_USER * ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission From d98e2a366fdf7640abef5a4094f1886c2e846b6a Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 12 Mar 2022 15:16:32 +0000 Subject: [PATCH 06/38] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c19b38d..a2353c0 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,12 @@ Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic i * Require dedicated domain like **kimai.domain.tld**. * This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server) -* As sqlite support ended on version 1.14, if you choosed an sqlite databse during installation, Kimai2 upgrade is blocked to version 1.13 #### Multi-user support LDAP is supported HTTP auth is not supported + Defaul Kimai2 roles are: * ROLE_USER * ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission diff --git a/README_fr.md b/README_fr.md index 0c81eb2..9ca7119 100644 --- a/README_fr.md +++ b/README_fr.md @@ -28,12 +28,12 @@ Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic i * Require dedicated domain like **kimai.domain.tld**. * This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server) -* As sqlite support ended on version 1.14, if you choosed an sqlite databse during installation, Kimai2 upgrade is blocked to version 1.13 #### Multi-user support LDAP is supported HTTP auth is not supported + Defaul Kimai2 roles are: * ROLE_USER * ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission From 5e72139f19fe8fff3e2705a939ed305869ea3f1e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 16:23:15 +0100 Subject: [PATCH 07/38] Update local.yaml --- conf/local.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/local.yaml b/conf/local.yaml index 031dbc9..d1d0f77 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: @@ -109,7 +110,7 @@ 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" } # An example which will set the display name in Kimai from the From 9fc5067a0f3911dafcce2e6cac01dc7f22a99641 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 16:23:37 +0100 Subject: [PATCH 08/38] Update nginx.conf --- conf/nginx.conf | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index d219fe5..ebd5089 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,17 +1,15 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -root __FINALPATH__/public/ ; - location __PATH__/ { # Path to source - # alias __FINALPATH__/public/ ; + alias __FINALPATH__/public/; - index index.php; + index index.html index.php; # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file #client_max_body_size 50M; - try_files $uri $uri/ /index.php$is_args$args; + try_files $uri $uri/ /__PATH__/index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; From 70fcca7e07ec6344a91ebe158f898a53b3b39084 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 16:28:22 +0100 Subject: [PATCH 09/38] Fix --- conf/local.yaml | 2 +- manifest.json | 4 ++++ scripts/install | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/conf/local.yaml b/conf/local.yaml index d1d0f77..d23025d 100644 --- a/conf/local.yaml +++ b/conf/local.yaml @@ -8,7 +8,7 @@ security: kimai_ldap: ~ kimai: user: - registration: "__REGISTRATION__" + registration: __REGISTRATION__ ldap: activate: true # more infos about the connection params can be found at: diff --git a/manifest.json b/manifest.json index 9cd58a5..930321e 100644 --- a/manifest.json +++ b/manifest.json @@ -38,6 +38,10 @@ "name": "domain", "type": "domain" }, + { + "name": "path", + "type": "path" + }, { "name": "admin", "type": "user" diff --git a/scripts/install b/scripts/install index 583a065..b554e90 100755 --- a/scripts/install +++ b/scripts/install @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url="/" +path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC registration=$YNH_APP_ARG_REGISTRATION From 9760375b484e92311ffa8f403149deae47abe633 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 16:29:06 +0100 Subject: [PATCH 10/38] Update manifest.json --- manifest.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 930321e..7352080 100644 --- a/manifest.json +++ b/manifest.json @@ -40,7 +40,9 @@ }, { "name": "path", - "type": "path" + "type": "path", + "example": "/kimai", + "default": "/kimai" }, { "name": "admin", From 58ad5034d088969ab53eab557944c0b1e9cd0dbb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 16:32:33 +0100 Subject: [PATCH 11/38] Fix --- manifest.json | 6 ------ scripts/install | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/manifest.json b/manifest.json index 7352080..9cd58a5 100644 --- a/manifest.json +++ b/manifest.json @@ -38,12 +38,6 @@ "name": "domain", "type": "domain" }, - { - "name": "path", - "type": "path", - "example": "/kimai", - "default": "/kimai" - }, { "name": "admin", "type": "user" diff --git a/scripts/install b/scripts/install index b554e90..583a065 100755 --- a/scripts/install +++ b/scripts/install @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH +path_url="/" admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC registration=$YNH_APP_ARG_REGISTRATION From bc9d6127702c77cd8d87270b9cb5366dec9eb22e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 16:40:22 +0100 Subject: [PATCH 12/38] Update upgrade --- scripts/upgrade | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 8c18576..4d04c05 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -95,7 +95,7 @@ then ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --keep="$final_path/config/packages/local.yaml $final_path/var/invoices $final_path/var/data $final_path/.env" + ynh_setup_source --dest_dir="$final_path" --keep="$final_path/var/invoices $final_path/var/data $final_path/.env" fi chmod 750 "$final_path" @@ -127,6 +127,23 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." # Create a dedicated PHP-FPM config ynh_add_fpm_config +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." + +if [ $registration -eq 1 ] +then + registration="true" +else + registration="false" +fi + +ynh_add_config --template="../conf/local.yaml" --destination="$final_path/config/packages/local.yaml" + +chmod 400 "$final_path/config/packages/local.yaml" +chown $app:$app "$final_path/config/packages/local.yaml" + #================================================= # SPECIFIC UPGRADE #================================================= From c461124eda72b716318f807f56fce003219cf66c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 17:32:07 +0100 Subject: [PATCH 13/38] Fix --- conf/.env.example | 54 ++++++++++++++++++----------------------------- conf/nginx.conf | 5 ++--- 2 files changed, 22 insertions(+), 37 deletions(-) diff --git a/conf/.env.example b/conf/.env.example index 2a53aaf..3f5e94d 100644 --- a/conf/.env.example +++ b/conf/.env.example @@ -1,36 +1,22 @@ -# 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/nginx.conf b/conf/nginx.conf index ebd5089..bbb2da6 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,5 +1,4 @@ -#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__/ { +location / { # Path to source alias __FINALPATH__/public/; @@ -9,7 +8,7 @@ location __PATH__/ { # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file #client_max_body_size 50M; - try_files $uri $uri/ /__PATH__/index.php; + try_files $uri $uri/ /index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; From 7d8ce27e3ddd0e81b82a3bb88218c1dfd093744a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 17:40:48 +0100 Subject: [PATCH 14/38] Add config panel --- config_panel.toml | 15 +++++++++++++++ scripts/install | 7 +------ scripts/upgrade | 11 ++++++++--- 3 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 config_panel.toml diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..cc4cc19 --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,15 @@ +version = "1.0" + +[main] +name = "Kimai2 configuration" + + [main.config] + name = "Configuration Options" + + [main.config.registration] + ask = "Enable registration" + type = "boolean" + yes = "true" + no = "false" + help = "Allow Kimai account creation" + bind = "registration:__FINALPATH__/config/packages/local.yaml" diff --git a/scripts/install b/scripts/install index 583a065..0107276 100755 --- a/scripts/install +++ b/scripts/install @@ -135,8 +135,7 @@ setfacl -R -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/" #================================================= ynh_script_progression --message="Adding a configuration file..." -if [ $registration -eq 1 ] -then +if [ $registration -eq 1 ]; then registration="true" else registration="false" @@ -158,14 +157,10 @@ chown $app:$app "$final_path/.env" #================================================= ynh_script_progression --message="Installing Kimai2..." -#update-alternatives --set php /usr/bin/php$phpversion - pushd "$final_path" ynh_exec_as $app php$phpversion bin/console kimai:install -n popd -#update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4d04c05..2604c35 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,9 +23,10 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) 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) -registration=$(ynh_app_setting_get --app=$app --key=registration) random_key=$(ynh_app_setting_get --app=$app --key=random_key) +registration=$(ynh_app_setting_get --app=$app --key=registration) + #================================================= # CHECK VERSION #================================================= @@ -59,6 +60,11 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +if [ -z "$registration" ]; then + registration_enabled="false" + ynh_app_setting_set --app=$app --key=registration --value=$registration +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -132,8 +138,7 @@ ynh_add_fpm_config #================================================= ynh_script_progression --message="Adding a configuration file..." -if [ $registration -eq 1 ] -then +if [ $registration -eq 1 ]; then registration="true" else registration="false" From b1e460d824916d61cacf6ae7cb1c22b0e9fc8e47 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 17:52:58 +0100 Subject: [PATCH 15/38] Update upgrade --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index 2604c35..56331f3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,6 +24,7 @@ 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) random_key=$(ynh_app_setting_get --app=$app --key=random_key) +phpversion=$YNH_PHP_VERSION registration=$(ynh_app_setting_get --app=$app --key=registration) From 0e07ef5755bfed7a0c7da28a47cf2cdebbc3302f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 17:56:29 +0100 Subject: [PATCH 16/38] Update upgrade --- scripts/upgrade | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 56331f3..626ebdd 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -171,14 +171,10 @@ setfacl -R -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/" #================================================= ynh_script_progression --message="Installing Kimai2..." -#update-alternatives --set php /usr/bin/php$phpversion - pushd "$final_path" ynh_exec_as $app php$phpversion bin/console kimai:update -n popd -#update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} - #================================================= # GENERIC FINALIZATION #================================================= From 3b337cb56bcb67d669b39c1263e8a18f3ccb3798 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 18:21:33 +0100 Subject: [PATCH 17/38] fix --- conf/.env.example | 1 - conf/local.yaml | 1 + doc/DISCLAIMER.md | 6 +++--- scripts/backup | 7 +++++++ scripts/install | 14 ++++++++++++++ scripts/remove | 12 ++++++++++++ scripts/restore | 16 +++++++++++++++- scripts/upgrade | 11 +++++++++++ 8 files changed, 63 insertions(+), 5 deletions(-) diff --git a/conf/.env.example b/conf/.env.example index 3f5e94d..30b9315 100644 --- a/conf/.env.example +++ b/conf/.env.example @@ -4,7 +4,6 @@ DATABASE_URL=mysql://__DB_USER__:__DB_PWD__@127.0.0.1:3306/__DB_NAME__?charset=u # 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= diff --git a/conf/local.yaml b/conf/local.yaml index d23025d..0c18b56 100644 --- a/conf/local.yaml +++ b/conf/local.yaml @@ -7,6 +7,7 @@ security: secured_area: kimai_ldap: ~ kimai: + data_dir: "__DATADIR__" user: registration: __REGISTRATION__ ldap: diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 59a4e84..f8ff3a0 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -3,10 +3,10 @@ #### Multi-user support -LDAP is supported -HTTP auth is not supported +- LDAP is supported +- HTTP auth is not supported -Defaul Kimai2 roles are: +#### Defaul Kimai2 roles are: * ROLE_USER * ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission * ROLE_ADMIN => Kimai2 (Admin) YunoHost permission diff --git a/scripts/backup b/scripts/backup index 86cad22..b86ddbf 100755 --- a/scripts/backup +++ b/scripts/backup @@ -31,6 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -43,6 +44,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$datadir" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index 0107276..5ffbe3d 100755 --- a/scripts/install +++ b/scripts/install @@ -114,6 +114,20 @@ ynh_script_progression --message="Configuring PHP-FPM..." ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#================================================= +# CREATE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Creating a data directory..." + +datadir=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=datadir --value=$datadir + +mkdir -p $datadir + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" + #================================================= # SPECIFIC SETUP #================================================= diff --git a/scripts/remove b/scripts/remove index 9fb39ec..e88de1c 100755 --- a/scripts/remove +++ b/scripts/remove @@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # STANDARD REMOVE @@ -39,6 +40,17 @@ ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" +#================================================= +# REMOVE DATA DIR +#================================================= + +# Remove the data directory if --purge option is used +if [ "${YNH_APP_PURGE:-0}" -eq 1 ] +then + ynh_script_progression --message="Removing app data directory..." + ynh_secure_remove --file="$datadir" +fi + #================================================= # REMOVE NGINX CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index 171f473..ab21fbd 100755 --- a/scripts/restore +++ b/scripts/restore @@ -33,6 +33,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -72,6 +73,19 @@ 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 DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." + +ynh_restore_file --origin_path="$datadir" --not_mandatory + +mkdir -p $datadir + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -80,7 +94,7 @@ 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 +# Recreate a dedicated PHP-FPM config ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) diff --git a/scripts/upgrade b/scripts/upgrade index 626ebdd..f3e4252 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,7 @@ db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) random_key=$(ynh_app_setting_get --app=$app --key=random_key) phpversion=$YNH_PHP_VERSION +datadir=$(ynh_app_setting_get --app=$app --key=datadir) registration=$(ynh_app_setting_get --app=$app --key=registration) @@ -66,6 +67,16 @@ if [ -z "$registration" ]; then ynh_app_setting_set --app=$app --key=registration --value=$registration fi +# If public_path doesn't exist, create it +if [ -z "$datadir" ]; then + datadir=/home/yunohost.app/$app + mkdir -p $datadir + chmod 750 "$datadir" + chmod -R o-rwx "$datadir" + chown -R $app:www-data "$datadir" + ynh_app_setting_set --app=$app --key=datadir --value=$datadir +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all From 84ae31f8b68a08685a8e227d67b1bf3273109522 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 12 Mar 2022 17:21:38 +0000 Subject: [PATCH 18/38] Auto-update README --- README.md | 6 +++--- README_fr.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a2353c0..99fef02 100644 --- a/README.md +++ b/README.md @@ -35,10 +35,10 @@ Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic i #### Multi-user support -LDAP is supported -HTTP auth is not supported +- LDAP is supported +- HTTP auth is not supported -Defaul Kimai2 roles are: +#### Defaul Kimai2 roles are: * ROLE_USER * ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission * ROLE_ADMIN => Kimai2 (Admin) YunoHost permission diff --git a/README_fr.md b/README_fr.md index 9ca7119..e2940f4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -31,10 +31,10 @@ Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic i #### Multi-user support -LDAP is supported -HTTP auth is not supported +- LDAP is supported +- HTTP auth is not supported -Defaul Kimai2 roles are: +#### Defaul Kimai2 roles are: * ROLE_USER * ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission * ROLE_ADMIN => Kimai2 (Admin) YunoHost permission From 731a6eb5cf31da0a7117ff580add69f24037c819 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 18:22:28 +0100 Subject: [PATCH 19/38] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index f3e4252..e0891ad 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -67,7 +67,7 @@ if [ -z "$registration" ]; then ynh_app_setting_set --app=$app --key=registration --value=$registration fi -# If public_path doesn't exist, create it +# If datadir doesn't exist, create it if [ -z "$datadir" ]; then datadir=/home/yunohost.app/$app mkdir -p $datadir From 433696cd613dd5d4cf28d5bbfb1e42868010c039 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 18:29:43 +0100 Subject: [PATCH 20/38] Update local.yaml --- conf/local.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/local.yaml b/conf/local.yaml index 0c18b56..8617356 100644 --- a/conf/local.yaml +++ b/conf/local.yaml @@ -8,6 +8,7 @@ security: kimai_ldap: ~ kimai: data_dir: "__DATADIR__" + user: registration: __REGISTRATION__ ldap: From 7f7e5017b265ca7a70e91be5bccb549230407aba Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 18:34:20 +0100 Subject: [PATCH 21/38] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 9cd58a5..d942c35 100644 --- a/manifest.json +++ b/manifest.json @@ -57,7 +57,7 @@ "name": "registration", "type": "boolean", "ask": { - "en": "Are new users allowed to register ?", + "en": "Are new users allowed to register?", "fr": "Est-ce que de nouveaux utilisateurs peuvent s'y inscrire ?", "de": "Sollen sich neue Benutzer selber registrieren können ?", "cs": "Mohou se noví uživatelé registrovat?" From 6fbf09c43ed66560415a870a2201868f13626fcf Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 12 Mar 2022 23:43:50 +0100 Subject: [PATCH 22/38] Update install --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index 5ffbe3d..9ab86aa 100755 --- a/scripts/install +++ b/scripts/install @@ -30,6 +30,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC registration=$YNH_APP_ARG_REGISTRATION random_key=$(ynh_string_random 32) phpversion=$YNH_PHP_VERSION +email=$(ynh_user_get_info --username=$admin --key=mail) app=$YNH_APP_INSTANCE_NAME @@ -173,6 +174,7 @@ ynh_script_progression --message="Installing Kimai2..." pushd "$final_path" ynh_exec_as $app php$phpversion bin/console kimai:install -n + ynh_exec_as $app php$phpversion bin/console kimai:create-user $admin $email ROLE_SUPER_ADMIN -n popd #================================================= From 963dae7041016ce3173d911782a0be558fcb988f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Mar 2022 00:01:25 +0100 Subject: [PATCH 23/38] Fix --- conf/local.yaml | 10 +++++----- scripts/install | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/conf/local.yaml b/conf/local.yaml index 8617356..95d3fcf 100644 --- a/conf/local.yaml +++ b/conf/local.yaml @@ -112,12 +112,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: "uid", 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 @@ -135,8 +135,8 @@ kimai: # The following example rule will be expanded to (for user "foo"): # (&(&(objectClass=groupOfNames))(member=foo)) # default: empty - filter: "(&(|(objectclass=posixAccount))(uid={{username}})(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))" - + 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! diff --git a/scripts/install b/scripts/install index 9ab86aa..5ffbe3d 100755 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,6 @@ is_public=$YNH_APP_ARG_IS_PUBLIC registration=$YNH_APP_ARG_REGISTRATION random_key=$(ynh_string_random 32) phpversion=$YNH_PHP_VERSION -email=$(ynh_user_get_info --username=$admin --key=mail) app=$YNH_APP_INSTANCE_NAME @@ -174,7 +173,6 @@ ynh_script_progression --message="Installing Kimai2..." pushd "$final_path" ynh_exec_as $app php$phpversion bin/console kimai:install -n - ynh_exec_as $app php$phpversion bin/console kimai:create-user $admin $email ROLE_SUPER_ADMIN -n popd #================================================= From 633b25d4abad8e32c63b08dec144bf1af48fb17f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Mar 2022 07:05:22 +0100 Subject: [PATCH 24/38] Update DISCLAIMER.md --- doc/DISCLAIMER.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index f8ff3a0..6666dd2 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,14 +1,14 @@ -* Require dedicated domain like **kimai.domain.tld**. -* This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server) +- Require dedicated domain like **kimai.domain.tld**. +- This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server) #### Multi-user support - LDAP is supported - HTTP auth is not supported -#### Defaul Kimai2 roles are: -* ROLE_USER -* ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission -* ROLE_ADMIN => Kimai2 (Admin) YunoHost permission -* ROLE_SUPER_ADMIN => Kimai2 (Super_Admin) YunoHost permission +#### Default Kimai2 roles are: +- ROLE_USER +- ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission +- ROLE_ADMIN => Kimai2 (Admin) YunoHost permission +- ROLE_SUPER_ADMIN => Kimai2 (Super_Admin) YunoHost permission Those roles are directly managed using YunoHost permission system. User choosen during installation is granted the ROLE_SUPER_ADMIN From 465b30dffaa27b8758fb221c5fa803fe576a964f Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 13 Mar 2022 06:05:28 +0000 Subject: [PATCH 25/38] Auto-update README --- README.md | 14 +++++++------- README_fr.md | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 99fef02..e18df62 100644 --- a/README.md +++ b/README.md @@ -30,19 +30,19 @@ Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic i ## Disclaimers / important information -* Require dedicated domain like **kimai.domain.tld**. -* This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server) +- Require dedicated domain like **kimai.domain.tld**. +- This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server) #### Multi-user support - LDAP is supported - HTTP auth is not supported -#### Defaul Kimai2 roles are: -* ROLE_USER -* ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission -* ROLE_ADMIN => Kimai2 (Admin) YunoHost permission -* ROLE_SUPER_ADMIN => Kimai2 (Super_Admin) YunoHost permission +#### Default Kimai2 roles are: +- ROLE_USER +- ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission +- ROLE_ADMIN => Kimai2 (Admin) YunoHost permission +- ROLE_SUPER_ADMIN => Kimai2 (Super_Admin) YunoHost permission Those roles are directly managed using YunoHost permission system. User choosen during installation is granted the ROLE_SUPER_ADMIN ## Documentation and resources diff --git a/README_fr.md b/README_fr.md index e2940f4..0bf239a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,19 +26,19 @@ Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic i ## Avertissements / informations importantes -* Require dedicated domain like **kimai.domain.tld**. -* This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server) +- Require dedicated domain like **kimai.domain.tld**. +- This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server) #### Multi-user support - LDAP is supported - HTTP auth is not supported -#### Defaul Kimai2 roles are: -* ROLE_USER -* ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission -* ROLE_ADMIN => Kimai2 (Admin) YunoHost permission -* ROLE_SUPER_ADMIN => Kimai2 (Super_Admin) YunoHost permission +#### Default Kimai2 roles are: +- ROLE_USER +- ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission +- ROLE_ADMIN => Kimai2 (Admin) YunoHost permission +- ROLE_SUPER_ADMIN => Kimai2 (Super_Admin) YunoHost permission Those roles are directly managed using YunoHost permission system. User choosen during installation is granted the ROLE_SUPER_ADMIN ## Documentations et ressources From 8417638f087d01f466aba3021753c98b5010a346 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Mar 2022 07:12:02 +0100 Subject: [PATCH 26/38] Remoce sqlite --- check_process | 26 +------------------------- manifest.json | 4 ++-- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/check_process b/check_process index f514ce4..70cd552 100644 --- a/check_process +++ b/check_process @@ -1,32 +1,8 @@ -;; Test complet mysql +;; Test complet ; Manifest domain="domain.tld" admin="john" is_public=1 - database="mysql" - registration=1 - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - 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 - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=0 -;; Test complet sqlite - ; Manifest - domain="domain.tld" - admin="john" - is_public=1 - database="sqlite" registration=1 ; Checks pkg_linter=1 diff --git a/manifest.json b/manifest.json index d942c35..5531809 100644 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "description": { "en": "Multi-user application for time-tracking with support for mobile devices", "fr": "Application web de suivi du temps, multi-utilisateurs, et compatible avec les appareils mobiles", - "de": "Eine web-basierte Mehrbenutzer-Zeiterfassung mit Rechnungsdruck mit Unterstützung für mobile Endgeräte", + "de": "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.18.2~ynh1", @@ -58,7 +58,7 @@ "type": "boolean", "ask": { "en": "Are new users allowed to register?", - "fr": "Est-ce que de nouveaux utilisateurs peuvent s'y inscrire ?", + "fr": "Les nouveaux utilisateurs sont-ils autorisés à s'inscrire ?", "de": "Sollen sich neue Benutzer selber registrieren können ?", "cs": "Mohou se noví uživatelé registrovat?" }, From a4332f8fcade1362399a24d5d25d98551a0c1238 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Mar 2022 07:23:49 +0100 Subject: [PATCH 27/38] remove datadir --- conf/local.yaml | 4 +--- scripts/backup | 7 ------- scripts/install | 14 -------------- scripts/remove | 12 ------------ scripts/restore | 14 -------------- scripts/upgrade | 11 ----------- 6 files changed, 1 insertion(+), 61 deletions(-) diff --git a/conf/local.yaml b/conf/local.yaml index 95d3fcf..4419987 100644 --- a/conf/local.yaml +++ b/conf/local.yaml @@ -6,9 +6,7 @@ security: firewalls: secured_area: kimai_ldap: ~ -kimai: - data_dir: "__DATADIR__" - +kimai: user: registration: __REGISTRATION__ ldap: diff --git a/scripts/backup b/scripts/backup index b86ddbf..86cad22 100755 --- a/scripts/backup +++ b/scripts/backup @@ -31,7 +31,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -44,12 +43,6 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" -#================================================= -# BACKUP THE DATA DIR -#================================================= - -ynh_backup --src_path="$datadir" --is_big - #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index 5ffbe3d..0107276 100755 --- a/scripts/install +++ b/scripts/install @@ -114,20 +114,6 @@ ynh_script_progression --message="Configuring PHP-FPM..." ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -#================================================= -# CREATE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Creating a data directory..." - -datadir=/home/yunohost.app/$app -ynh_app_setting_set --app=$app --key=datadir --value=$datadir - -mkdir -p $datadir - -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" - #================================================= # SPECIFIC SETUP #================================================= diff --git a/scripts/remove b/scripts/remove index e88de1c..9fb39ec 100755 --- a/scripts/remove +++ b/scripts/remove @@ -20,7 +20,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # STANDARD REMOVE @@ -40,17 +39,6 @@ ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" -#================================================= -# REMOVE DATA DIR -#================================================= - -# Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing app data directory..." - ynh_secure_remove --file="$datadir" -fi - #================================================= # REMOVE NGINX CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index ab21fbd..c11ade6 100755 --- a/scripts/restore +++ b/scripts/restore @@ -33,7 +33,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -73,19 +72,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 DATA DIRECTORY -#================================================= -ynh_script_progression --message="Restoring the data directory..." - -ynh_restore_file --origin_path="$datadir" --not_mandatory - -mkdir -p $datadir - -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" - #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e0891ad..626ebdd 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,7 +25,6 @@ db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) random_key=$(ynh_app_setting_get --app=$app --key=random_key) phpversion=$YNH_PHP_VERSION -datadir=$(ynh_app_setting_get --app=$app --key=datadir) registration=$(ynh_app_setting_get --app=$app --key=registration) @@ -67,16 +66,6 @@ if [ -z "$registration" ]; then ynh_app_setting_set --app=$app --key=registration --value=$registration fi -# If datadir doesn't exist, create it -if [ -z "$datadir" ]; then - datadir=/home/yunohost.app/$app - mkdir -p $datadir - chmod 750 "$datadir" - chmod -R o-rwx "$datadir" - chown -R $app:www-data "$datadir" - ynh_app_setting_set --app=$app --key=datadir --value=$datadir -fi - # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all From 96db2623e2c1c0495040cc8d5d3eacbec0003f7a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Mar 2022 07:24:20 +0100 Subject: [PATCH 28/38] Update config_panel.toml --- config_panel.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_panel.toml b/config_panel.toml index cc4cc19..2c74055 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -11,5 +11,5 @@ name = "Kimai2 configuration" type = "boolean" yes = "true" no = "false" - help = "Allow Kimai account creation" + help = "Allow Kimai2 account creation" bind = "registration:__FINALPATH__/config/packages/local.yaml" From 0fd0f1964dab801afa7aef7479eee7e21f3f4ed0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Mar 2022 07:25:58 +0100 Subject: [PATCH 29/38] Create change_url --- scripts/change_url | 111 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 scripts/change_url diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..3c5ef1e --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,111 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +old_domain=$YNH_APP_OLD_DOMAIN +old_path=$YNH_APP_OLD_PATH + +new_domain=$YNH_APP_NEW_DOMAIN +new_path="/" + +app=$YNH_APP_INSTANCE_NAME + +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." + +# Needed for helper "ynh_add_nginx_config" +final_path=$(ynh_app_setting_get --app=$app --key=final_path) + +#================================================= +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." + +# 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 +#================================================= + +change_domain=0 +if [ "$old_domain" != "$new_domain" ] +then + change_domain=1 +fi + +change_path=0 +if [ "$old_path" != "$new_path" ] +then + change_path=1 +fi + +#================================================= +# MODIFY URL IN NGINX CONF +#================================================= +ynh_script_progression --message="Updating NGINX web server configuration..." + +nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +# Change the path in the NGINX config file +if [ $change_path -eq 1 ] +then + # Make a backup of the original NGINX config file if modified + ynh_backup_if_checksum_is_different --file="$nginx_conf_path" + # Set global variables for NGINX helper + domain="$old_domain" + path_url="$new_path" + # Create a dedicated NGINX config + ynh_add_nginx_config +fi + +# Change the domain for NGINX +if [ $change_domain -eq 1 ] +then + # Delete file checksum for the old conf file location + ynh_delete_file_checksum --file="$nginx_conf_path" + mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + # Store file checksum for the new config file location + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +fi + +#================================================= +# SPECIFIC MODIFICATIONS +#================================================= +# ... +#================================================= + +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading NGINX web server..." + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Change of URL completed for $app" From 5371b1c18585c358b639208598c27b1a167390c9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Mar 2022 07:32:20 +0100 Subject: [PATCH 30/38] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 0107276..99c4a1d 100755 --- a/scripts/install +++ b/scripts/install @@ -28,7 +28,7 @@ path_url="/" admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC registration=$YNH_APP_ARG_REGISTRATION -random_key=$(ynh_string_random 32) +random_key=$(ynh_string_random --length=32) phpversion=$YNH_PHP_VERSION app=$YNH_APP_INSTANCE_NAME @@ -135,7 +135,7 @@ setfacl -R -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/" #================================================= ynh_script_progression --message="Adding a configuration file..." -if [ $registration -eq 1 ]; then +if [ $registration -eq 1 ]; then registration="true" else registration="false" From f54914d7c39454ef01e70e87683fdc15ba7754c0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Mar 2022 07:40:10 +0100 Subject: [PATCH 31/38] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 626ebdd..4e017bf 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -139,7 +139,7 @@ ynh_add_fpm_config #================================================= ynh_script_progression --message="Adding a configuration file..." -if [ $registration -eq 1 ]; then +if [ $registration -eq 1 ]; then registration="true" else registration="false" From 9820f516a2a6a15b5820f3e24b90e7a0b2ee1fc2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Mar 2022 07:43:50 +0100 Subject: [PATCH 32/38] Update local.yaml --- conf/local.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/local.yaml b/conf/local.yaml index 4419987..8bd091a 100644 --- a/conf/local.yaml +++ b/conf/local.yaml @@ -6,7 +6,7 @@ security: firewalls: secured_area: kimai_ldap: ~ -kimai: +kimai: user: registration: __REGISTRATION__ ldap: From a92d35e1db4acd08cdffc632733b1a0aea783880 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 21 Apr 2022 11:00:40 +0200 Subject: [PATCH 33/38] 1.19.4 --- check_process | 12 ++++-------- conf/app.src | 4 ++-- manifest.json | 2 +- scripts/_common.sh | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/check_process b/check_process index 70cd552..d9b0ce0 100644 --- a/check_process +++ b/check_process @@ -12,10 +12,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,7 +22,5 @@ Email=anmol@datamol.org Notification=change ;;; Upgrade options - ; commit=22580412fae14859f661c1f9b54a3131a60c9323 - name=1.9~ynh1 - ; commit=f26285511a167a1ed591a7fa96ae786ea89efb1e - name=1.11.1~ynh1 + ; commit=6b3ab38a5bf6aa48aaef23254381e8063839598b + name=1.11.1~ynh1 #45 diff --git a/conf/app.src b/conf/app.src index 2a2e81b..1958c6d 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.18.2.tar.gz -SOURCE_SUM=76e9f5fa19a6416d794c82419926adfadae365d838f46df7f8455ab9a4bc8849 +SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.19.4.tar.gz +SOURCE_SUM=df14c037639f4002a52268ef157fcccbfd3ccec8d6cf0dc247df56f6b36f2848 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 5531809..78cfbf5 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ "de": "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.18.2~ynh1", + "version": "1.19.4~ynh1", "url": "https://www.kimai.org", "upstream": { "license": "MIT", diff --git a/scripts/_common.sh b/scripts/_common.sh index fb8c438..3a762e4 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ YNH_PHP_VERSION="8.0" -YNH_COMPOSER_VERSION="2.2.7" +YNH_COMPOSER_VERSION="2.3.3" pkg_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl 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" From 3e3b6011201648fb8a313c5ca0739e13d81c887d Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 21 Apr 2022 09:00:46 +0000 Subject: [PATCH 34/38] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e18df62..79fe44c 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ 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.18.2~ynh1 +**Shipped version:** 1.19.4~ynh1 **Demo:** https://www.kimai.org/demo/ diff --git a/README_fr.md b/README_fr.md index 0bf239a..758174f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,7 +16,7 @@ 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.18.2~ynh1 +**Version incluse :** 1.19.4~ynh1 **Démo :** https://www.kimai.org/demo/ From ca991f7d1983cae40b5e865107a548fa99cd7455 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 21 Apr 2022 16:09:59 +0200 Subject: [PATCH 35/38] Update restore --- scripts/restore | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/restore b/scripts/restore index c11ade6..27ed107 100755 --- a/scripts/restore +++ b/scripts/restore @@ -72,6 +72,16 @@ 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/" +#================================================= +# SPECIFIC RESTORATION +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -84,16 +94,6 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." - -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE THE MYSQL DATABASE #================================================= From d4a53663164cae011414d552a563c5f8e533112c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 12 May 2022 14:58:05 +0200 Subject: [PATCH 36/38] 1.19.7 --- conf/app.src | 4 ++-- manifest.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index 1958c6d..f41837f 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.19.4.tar.gz -SOURCE_SUM=df14c037639f4002a52268ef157fcccbfd3ccec8d6cf0dc247df56f6b36f2848 +SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.19.7.tar.gz +SOURCE_SUM=592122e74cae046a9e4dc89fbd7bf31464afe0c5f3edd82927c3921dac23223d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 78cfbf5..6848a42 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ "de": "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.19.4~ynh1", + "version": "1.19.7~ynh1", "url": "https://www.kimai.org", "upstream": { "license": "MIT", From e5d4af6818faed67a44b2fb7767ff8550e24ef28 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 12 May 2022 12:58:11 +0000 Subject: [PATCH 37/38] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 79fe44c..7c5ccdf 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ 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.19.4~ynh1 +**Shipped version:** 1.19.7~ynh1 **Demo:** https://www.kimai.org/demo/ diff --git a/README_fr.md b/README_fr.md index 758174f..163bf84 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,7 +16,7 @@ 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.19.4~ynh1 +**Version incluse :** 1.19.7~ynh1 **Démo :** https://www.kimai.org/demo/ From 49a38810a4c358e6ec01df77081c9737d32c78fd Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 12 May 2022 14:59:44 +0200 Subject: [PATCH 38/38] Update check_process --- check_process | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/check_process b/check_process index d9b0ce0..3e1a207 100644 --- a/check_process +++ b/check_process @@ -16,11 +16,10 @@ upgrade=1 from_commit=6b3ab38a5bf6aa48aaef23254381e8063839598b backup_restore=1 multi_instance=1 - port_already_use=0 change_url=0 ;;; Options Email=anmol@datamol.org Notification=change ;;; Upgrade options ; commit=6b3ab38a5bf6aa48aaef23254381e8063839598b - name=1.11.1~ynh1 #45 + name=Merge pull request #45 from YunoHost-Apps/testing