diff --git a/config_panel.toml b/config_panel.toml index 5e3ade8..85513de 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -72,10 +72,14 @@ services = ["php8.2-fpm"] [main.apps] name = "Apps" - [main.apps.auto_update] - ask = "Auto update apps" - type = "boolean" - help = "Automatically update apps each night" + [main.apps.auto_upgrade_apps] + ask = "Upgrade apps" + type = "select" + choices.manual = "Manually" + choices.daily = "Daily at 00:10" + choices.weekly = "Weekly at 00:10 on Sunday" + choices.monthly = "Monthly at 00:10 on the 1st" + help = "Keep in mind that upgrade apps could break things in your instance, so you need to strike the right balance between reliability and safety." [main.apps.defaultapp] ask = "Default app to display" diff --git a/scripts/config b/scripts/config index f7a56c4..da44282 100644 --- a/scripts/config +++ b/scripts/config @@ -65,6 +65,19 @@ get__free_footprint() { # SPECIFIC SETTERS FOR TOML SHORT KEYS #================================================= +set__auto_upgrade_apps() { + declare -A frequencies=( [daily]="10 00 * * *" [weekly]="10 00 * * 0" [monthly]="10 00 1 * *" ) + if [ "$frequencies[$auto_upgrade_apps]" ] + then + echo "${frequencies[$auto_upgrade_apps]} $app /usr/bin/php$phpversion --define apc.enable_cli=1 -f $install_dir/occ app:update --all" > /etc/cron.d/nextcloud_upgrade_apps + else + ynh_secure_remove --file=/etc/cron.d/nextcloud_upgrade_apps + fi + + ynh_app_setting_set --app=$app --key=auto_upgrade_apps --value="$auto_upgrade_apps" + +} + set__fpm_footprint() { if [ "$fpm_footprint" != "specific" ] then diff --git a/scripts/install b/scripts/install index e8c8831..d99a123 100755 --- a/scripts/install +++ b/scripts/install @@ -38,7 +38,7 @@ ynh_app_setting_set --app=$app --key=logout_url --value="" ynh_app_setting_set --app=$app --key=trashbin_retention_obligation --value="auto" ynh_app_setting_set --app=$app --key=version_retention_obligation --value="auto" ynh_app_setting_set --app=$app --key=enable_previews --value=1 -ynh_app_setting_set --app=$app --key=auto_update --value=1 +ynh_app_setting_set --app=$app --key=auto_upgrade_apps --value="manual" ynh_app_setting_set --app=$app --key=defaultapp --value="dashboard,files" #=================================================