diff --git a/README.md b/README.md index 5c343a8..6fc7650 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Online storage, file sharing platform and various other applications -**Shipped version:** 22.2.9~ynh1 +**Shipped version:** 25.0.1~ynh1 **Demo:** https://demo.nextcloud.com/ diff --git a/README_fr.md b/README_fr.md index f5f3104..e441d52 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Stockage en ligne, plateforme de partage de fichiers et diverses autres applications -**Version incluse :** 22.2.9~ynh1 +**Version incluse :** 25.0.1~ynh1 **Démo :** https://demo.nextcloud.com/ diff --git a/check_process b/check_process index 3cd66db..cbb9f3b 100644 --- a/check_process +++ b/check_process @@ -13,10 +13,8 @@ setup_private=1 setup_public=1 upgrade=1 - #21.0.2 - upgrade=1 from_commit=e249cced99423d8e6743312361f140c1fbdc3a1d - #22.2.3 - upgrade=1 from_commit=892f02888f31b6a0da850a5f8b2e66a151f84750 + #22.2.9 + upgrade=1 from_commit=f565b6d216f5340f752e6d6a21a14abc3811e0e7 backup_restore=1 multi_instance=1 change_url=1 @@ -24,10 +22,8 @@ Email= Notification=none ;;; Upgrade options - ; commit=e249cced99423d8e6743312361f140c1fbdc3a1d - name=Merge pull request #446 from YunoHost-Apps/22.2.0 - ; commit=892f02888f31b6a0da850a5f8b2e66a151f84750 - name=Merge pull request #457 from YunoHost-Apps/testing + ; commit=f565b6d216f5340f752e6d6a21a14abc3811e0e7 + name=Merge pull request #495 from YunoHost-Apps/22.2.9 manifest_arg=domain=DOMAIN&path=PATH&admin=USER&user_home=1& ; commit=e9e7015ed7667352c1c191fc632a9f6f382dd9d2 name=[fix] Upgrade to 20.0.4 (#346) diff --git a/conf/nginx.conf b/conf/nginx.conf index af84758..2678d48 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -8,7 +8,7 @@ location ^~ /.well-known { location = /.well-known/carddav { return 301 __PATH__/remote.php/dav/; } location = /.well-known/caldav { return 301 __PATH__/remote.php/dav/; } - + location = /.well-known/webfinger { return 301 __PATH__/index.php$uri; } location = /.well-known/nodeinfo { return 301 __PATH__/index.php$uri; } @@ -62,9 +62,6 @@ location ^~ __PATH__/ { # always provides the desired behaviour. index index.php index.html __PATH__/index.php$request_uri; - # Default Cache-Control policy - expires 1m; - # Rule borrowed from `.htaccess` to handle Microsoft DAV clients location = __PATH__/ { if ( $http_user_agent ~ ^DavClnt ) { diff --git a/config_panel.toml b/config_panel.toml index d6d0dd9..7598044 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -3,23 +3,36 @@ version = "1.0" [main] name = "Nextcloud configuration" + [main.maintenance_mode] + name = "Maintenance mode" + + [main.maintenance_mode.maintenance_mode] + ask = "Enable maintenance mode" + type = "boolean" + default = "0" + [main.php_fpm_config] name = "PHP-FPM configuration" [main.php_fpm_config.fpm_footprint] - ask = "Memory footprint of the service?" - choices = ["low", "medium", "high", "specific"] + ask = "Memory footprint" + type = "select" + choices.low = "Low, <= 20Mb per pool" + choices.medium = "Medium, between 20Mb and 40Mb per pool" + choices.high = "High, > 40Mb per pool" + choices.specific = "Use specific value" default = "low" - help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.
Use specific to set a value with the following option." - [main.php_fpm_config.free_footprint] + [main.php_fpm_config.fpm_free_footprint] + visible = "fpm_footprint == 'specific'" ask = "Memory footprint of the service?" type = "number" default = "0" help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values." [main.php_fpm_config.fpm_usage] - ask = "Expected usage of the service?" + ask = "Expected usage" + type = "select" choices = ["low", "medium", "high"] default = "low" help = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.
medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.
high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding." diff --git a/manifest.json b/manifest.json index c829948..799055d 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Online storage, file sharing platform and various other applications", "fr": "Stockage en ligne, plateforme de partage de fichiers et diverses autres applications" }, - "version": "22.2.9~ynh1", + "version": "25.0.1~ynh1", "url": "https://nextcloud.com", "upstream": { "license": "AGPL-3.0", @@ -14,7 +14,8 @@ "demo": "https://demo.nextcloud.com/", "admindoc": "https://docs.nextcloud.com/server/stable/admin_manual/", "userdoc": "https://docs.nextcloud.com/server/latest/user_manual/en/", - "code": "https://github.com/nextcloud/server" + "code": "https://github.com/nextcloud/server", + "cpe": "cpe:2.3:a:nextcloud:nextcloud" }, "license": "AGPL-3.0", "maintainer": { @@ -22,7 +23,7 @@ "email": "pierre@kayou.io" }, "requirements": { - "yunohost": ">= 11.0.4" + "yunohost": ">= 11.0.9" }, "multi_instance": true, "services": [ @@ -31,7 +32,7 @@ "mysql" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" @@ -66,4 +67,4 @@ } ] } -} +} \ No newline at end of file diff --git a/scripts/_common.sh b/scripts/_common.sh index f7c5218..6753863 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,8 @@ #================================================= YNH_PHP_VERSION="8.0" -pkg_dependencies="postgresql imagemagick libmagickcore-6.q16-6-extra acl tar smbclient at php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-igbinary php${YNH_PHP_VERSION}-bcmath" + +pkg_dependencies="postgresql imagemagick libmagickcore-6.q16-6-extra acl tar smbclient at php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-igbinary php${YNH_PHP_VERSION}-bcmath" #================================================= # EXPERIMENTAL HELPERS diff --git a/scripts/config b/scripts/config index 8a9110c..7b6b67e 100644 --- a/scripts/config +++ b/scripts/config @@ -22,6 +22,22 @@ current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) # SPECIFIC GETTERS FOR TOML SHORT KEY #================================================= +get__maintenance_mode() { + # Maintenance mode status + maintenance_mode_status="$(cd "$final_path" && ynh_exec_as "$app" \ + php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode)" 2> /dev/null + if echo $maintenance_mode_status | grep -q "disabled" + then + echo "0" + elif echo $maintenance_mode_status | grep -q "enabled" + then + echo "1" + else + ynh_print_err --message="Unexpected output from maintenance status check command." + exit 0 + fi +} + get__fpm_footprint() { # Free footprint value for php-fpm # Check if current_fpm_footprint is an integer @@ -49,6 +65,21 @@ get__free_footprint() { # SPECIFIC SETTERS FOR TOML SHORT KEYS #================================================= +set__maintenance_mode() { + if [ "$maintenance_mode" -eq "0" ]; then + # If maintenance_mode was set to 0, disable maintenance mode + (cd "$final_path" && ynh_exec_as "$app" \ + php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode --off) + ynh_print_info "Maintenance mode disabled" + elif [ "$maintenance_mode" -eq "1" ]; then + # If maintenance_mode was set to 1, enable maintenance mode + (cd "$final_path" && ynh_exec_as "$app" \ + php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode --on) + ynh_print_info "Maintenance mode enabled" + fi + ynh_app_setting_set --app=$app --key=maintenance_mode --value="$maintenance_mode" +} + set__fpm_footprint() { if [ "$fpm_footprint" != "specific" ] then @@ -56,10 +87,10 @@ set__fpm_footprint() { fi } -set__free_footprint() { - if [ "$fpm_footprint" == "specific" ] +set__fpm_free_footprint() { + if [ "$fpm_footprint" = "specific" ] then - ynh_app_setting_set --app=$app --key=fpm_footprint --value="$free_footprint" + ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint" fi } @@ -70,11 +101,11 @@ set__free_footprint() { ynh_app_config_validate() { _ynh_app_config_validate - if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[free_footprint]}" == "true" ]; then - # If fpm_footprint is set to 'specific', use $free_footprint value. - if [ "$fpm_footprint" == "specific" ] + if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then + # If fpm_footprint is set to 'specific', use $fpm_free_footprint value. + if [ "$fpm_footprint" = "specific" ] then - fpm_footprint=$free_footprint + fpm_footprint=$fpm_free_footprint fi if [ "$fpm_footprint" == "0" ] diff --git a/scripts/install b/scripts/install index 8f72483..257a1ac 100755 --- a/scripts/install +++ b/scripts/install @@ -40,6 +40,12 @@ test ! -e "$final_path" || ynh_die --message="This path already contains a folde # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +# Check machine architecture (Seens 25.0 Nextcloud doesn't support 32bit machines) +if [ $YNH_ARCH == "i386" ]; +then + ynh_die --message="Sorry, Nextcloud has deprecated 32-bit support" +fi + #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -50,6 +56,9 @@ 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=user_home --value=$user_home +maintenance_mode=0 +ynh_app_setting_set --app=$app --key=maintenance_mode --value=$maintenance_mode + #================================================= # STANDARD MODIFICATIONS #================================================= @@ -65,6 +74,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 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_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_name --db_name=$db_name @@ -105,8 +115,18 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Configuring PHP-FPM..." --weight=50 +fpm_footprint="high" +fpm_free_footprint=0 +fpm_usage="medium" + +ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint +ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage + # Create a dedicated php-fpm config -ynh_add_fpm_config --usage=medium --footprint=high +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION +# Used by ynh_add_nginx_config +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # NGINX CONFIGURATION diff --git a/scripts/remove b/scripts/remove index f6a1a3a..b7cb15b 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME 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) diff --git a/scripts/restore b/scripts/restore index cb328be..7391d33 100755 --- a/scripts/restore +++ b/scripts/restore @@ -27,6 +27,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) 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) @@ -105,15 +106,32 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" # Recreate a dedicated php-fpm config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + +# Check if .well-known is available for this domain +if is_url_handled --domain="$domain" --path="/.well-known/caldav" || is_url_handled --domain="$domain" --path="/.well-known/carddav" +then + ynh_print_warn --message="Another app already uses the domain $domain to serve a caldav/carddav feature. You may encounter issues when dealing with your calendar or address book." + + # Remove lines about .well-known/carddav and caldav with sed. + sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "/etc/nginx/conf.d/$domain.d/$app.conf" +fi + #================================================= # RESTORE THE CRON FILE #================================================= +ynh_script_progression --message="Restoring cron job..." --weight=1 ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= # BACKUP THE LOGROTATE CONFIGURATION #================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 ynh_restore_file --origin_path="/etc/logrotate.d/$app" diff --git a/scripts/upgrade b/scripts/upgrade index b6560a5..de9c6bc 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,8 +21,10 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name user_home=$(ynh_app_setting_get --app=$app --key=user_home) +maintenance_mode=$(ynh_app_setting_get --app=$app --key=maintenance_mode) fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) @@ -32,6 +34,12 @@ fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) upgrade_type=$(ynh_check_app_version_changed) +# Check machine architecture (Seens 25.0 Nextcloud doesn't support 32bit machines) +if [ $YNH_ARCH == "i386" ]; +then + ynh_die --message="Sorry, Nextcloud has deprecated 32-bit support" +fi + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -58,12 +66,24 @@ fi # Remove the option backup_core_only if it's in the settings.yml file ynh_app_setting_delete --app=$app --key=backup_core_only +# If maintenance_mode doesn't exist, create it +if [ -z "$maintenance_mode" ]; then + maintenance_mode=0 + ynh_app_setting_set --app=$app --key=maintenance_mode --value=$maintenance_mode +fi + # If fpm_footprint doesn't exist, create it if [ -z "$fpm_footprint" ]; then fpm_footprint=high ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint fi +# If fpm_free_footprint doesn't exist, create it +if [ -z "$fpm_free_footprint" ]; then + fpm_free_footprint=0 + ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint +fi + # If fpm_usage doesn't exist, create it if [ -z "$fpm_usage" ]; then fpm_usage=medium diff --git a/scripts/upgrade.d/upgrade.23.sh b/scripts/upgrade.d/upgrade.23.sh new file mode 100644 index 0000000..eb2b944 --- /dev/null +++ b/scripts/upgrade.d/upgrade.23.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Last available Nextcloud version +next_version="24.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="176cb5620f20465fb4759bdf3caaebeb7acff39d6c8630351af9f8738c173780" diff --git a/scripts/upgrade.d/upgrade.24.sh b/scripts/upgrade.d/upgrade.24.sh new file mode 100644 index 0000000..658c57d --- /dev/null +++ b/scripts/upgrade.d/upgrade.24.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Last available Nextcloud version +next_version="25.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="2c05ac9d7b72b44ef8b3d2ae03ff0fd6121e254b8054556f5163bd8760dd8f49" diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh old mode 100755 new mode 100644 index 3382934..4b026f4 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,7 +1,7 @@ #!/bin/bash # Last available Nextcloud version -next_version="22.2.9" +next_version="25.0.1" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="0beb6b959db855e30023954bd1299b6bb1331f895e3095b51350ab5eaeb5b1cd" +nextcloud_source_sha256="72d4076924caf19139c40178597af6211799e20440ce196fb43b9c4e47d77515" diff --git a/sources/patches_last_version/app-02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch b/sources/patches_last_version/app-02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch index 38f37f9..43159c3 100644 --- a/sources/patches_last_version/app-02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch +++ b/sources/patches_last_version/app-02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch @@ -12,6 +12,6 @@ index e9ecf00036..8e69c8d2dc 100644 - protected $evalScriptAllowed = false; + // YunoHost patch: allow for eval in JS scripts for YunoHost tile + protected $evalScriptAllowed = true; - /** @var array Domains from which scripts can get loaded */ - protected $allowedScriptDomains = [ - '\'self\'', + /** @var bool Whether strict-dynamic should be set */ + protected $strictDynamicAllowed = null; + /** @var array Domains from which scripts can get loaded */