diff --git a/issue_template.md b/.github/ISSUE_TEMPLATE.md similarity index 55% rename from issue_template.md rename to .github/ISSUE_TEMPLATE.md index ae65abb..2729a6b 100644 --- a/issue_template.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,6 +1,6 @@ --- name: Bug report -about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all. +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. --- @@ -8,28 +8,30 @@ about: Create a report to help us debug, it would be nice to fill the template a 1. *Read this whole template first.* 2. *Determine if you are on the right place:* - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - - *Otherwise, the issue may be due to Moodle itself. Refer to its documentation or repository for help.* - - *If you have a doubt, post here, we will figure it out together.* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* 3. *Delete the italic comments as you write over them below, and remove this guide.* --- -**Describe the bug** +### Describe the bug + *A clear and concise description of what the bug is.* -**Versions** +### Context + - Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* - YunoHost version: x.x.x - I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* -- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* - If yes, please explain: - Using, or trying to install package version/branch: - If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* -**To Reproduce** -*Steps to reproduce the behavior.* +### Steps to reproduce + - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh - sudo yunohost app install moodle + sudo yunohost app install the_app ``` - *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If the error occurs in your browser, explain what you did:* @@ -38,9 +40,16 @@ about: Create a report to help us debug, it would be nice to fill the template a 3. *Scroll down to '...'* 4. *See error* -**Expected behavior** +### Expected behavior + *A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* -**Logs** -*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.* +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + *If applicable and useful, add screenshots to help explain your problem.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/README.md b/README.md index 28216db..a3e5e44 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ + + # Moodle for YunoHost [![Integration level](https://dash.yunohost.org/integration/moodle.svg)](https://dash.yunohost.org/appci/app/moodle) ![](https://ci-apps.yunohost.org/ci/badges/moodle.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/moodle.maintain.svg) @@ -5,30 +10,27 @@ *[Lire ce readme en français.](./README_fr.md)* -> *This package allows you to install Moodle quickly and simply on a YunoHost server. +> *This package allows you to install Moodle quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -[Moodle](https://moodle.org) is a learning platform designed to provide educators, administrators and learners with a single robust, secure and integrated system to create personalised learning environments. Moodle is widely used around the world by universities, schools, companies and all manner of organisations and individuals. -**Shipped version:** 3.10.3 +Online learning platform + +**Shipped version:** 3.11.0~ynh1 + +**Demo:** https://sandbox.moodledemo.net/ ## Screenshots -![](https://upload.wikimedia.org/wikipedia/commons/3/36/Moodle_2.0_on_Firefox_4.0.png) +![](./doc/screenshots/Moodle_2.0_on_Firefox_4.0.png) -## Demo - -* [Official demo](https://sandbox.moodledemo.net/) +## Disclaimers / important information ## Configuration How to configure this app: by an admin panel. -## Documentation - - * Official documentation: https://docs.moodle.org/39/en/Main_page - ## YunoHost specific features #### Multi-user support @@ -36,19 +38,13 @@ How to configure this app: by an admin panel. * Are LDAP and HTTP auth supported? **Yes** * Can the app be used by multiple users? **Yes** -#### Supported architectures +## Documentation and resources -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/moodle.svg)](https://ci-apps.yunohost.org/ci/apps/moodle/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/moodle.svg)](https://ci-apps-arm.yunohost.org/ci/apps/moodle/) - -## Links - - * Report a bug: https://github.com/YunoHost-Apps/moodle_ynh/issues - * App website: https://moodle.org/ - * Upstream app repository: http://git.moodle.org/ - https://github.com/moodle/moodle - * YunoHost website: https://yunohost.org/ - ---- +* Official app website: https://moodle.org/ +* Official admin documentation: https://docs.moodle.org/311/en/Main_page +* Upstream app code repository: https://github.com/moodle/moodle +* YunoHost documentation for this app: https://yunohost.org/app_moodle +* Report a bug: https://github.com/YunoHost-Apps/moodle_ynh/issues ## Developer info @@ -60,3 +56,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/moodle_ynh/tree/testi or sudo yunohost app upgrade moodle -u https://github.com/YunoHost-Apps/moodle_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index 8ccc57f..9cc2494 100644 --- a/README_fr.md +++ b/README_fr.md @@ -3,52 +3,35 @@ [![Niveau d'intégration](https://dash.yunohost.org/integration/moodle.svg)](https://dash.yunohost.org/appci/app/moodle) ![](https://ci-apps.yunohost.org/ci/badges/moodle.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/moodle.maintain.svg) [![Installer Moodle avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=moodle) -*[Read this readme in english.](./README.md)* +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* -> *Ce package vous permet d'installer Moodle rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* +> *Ce package vous permet d'installer Moodle rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* ## Vue d'ensemble -[Moodle](https://moodle.org) est une plateforme d'apprentissage conçue pour fournir aux enseignants, aux administrateurs et aux apprenants un système unique robuste, sécurisé et intégré pour créer des environnements d'apprentissage personnalisés. Moodle est largement utilisé dans le monde entier par les universités, les écoles, les entreprises et toutes sortes d'organisations et d'individus. -**Version incluse :** 3.10.3 +Plateforme d'apprentissage en ligne + +**Version incluse :** 3.11.0~ynh1 + +**Démo :** https://sandbox.moodledemo.net/ ## Captures d'écran -![](https://upload.wikimedia.org/wikipedia/commons/3/36/Moodle_2.0_on_Firefox_4.0.png) +![](./doc/screenshots/Moodle_2.0_on_Firefox_4.0.png) -## Démo +## Avertissements / informations importantes -* [Démo officielle](https://sandbox.moodledemo.net/) +- Cette app est intégrée avec le LDAP / SSO de Yunohost -## Configuration +## Documentations et ressources -* Comment configurer cette application : via le panneau d'administration. - -## Documentation - -* Documentation officielle : https://docs.moodle.org/39/en/Main_page - -## Caractéristiques spécifiques YunoHost - -#### Support multi-utilisateur - -* L'authentification LDAP et HTTP est-elle prise en charge ? **Oui** -* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** - -#### Architectures supportées - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/moodle.svg)](https://ci-apps.yunohost.org/ci/apps/moodle/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/moodle.svg)](https://ci-apps-arm.yunohost.org/ci/apps/moodle/) - -## Liens - - * Signaler un bug :https://github.com/YunoHost-Apps/moodle_ynh/issues - * Site de l'application : https://moodle.org/ - * Dépôt de l'application principale : http://git.moodle.org/ - https://github.com/moodle/moodle - * Site web YunoHost : https://yunohost.org/ - ---- +* Site officiel de l'app : https://moodle.org/ +* Documentation officielle de l'admin : https://docs.moodle.org/311/en/Main_page +* Dépôt de code officiel de l'app : https://github.com/moodle/moodle +* Documentation YunoHost pour cette app : https://yunohost.org/app_moodle +* Signaler un bug : https://github.com/YunoHost-Apps/moodle_ynh/issues ## Informations pour les développeurs @@ -60,3 +43,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/moodle_ynh/tree/testi ou sudo yunohost app upgrade moodle -u https://github.com/YunoHost-Apps/moodle_ynh/tree/testing --debug ``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/check_process b/check_process index 209432d..671162b 100644 --- a/check_process +++ b/check_process @@ -1,9 +1,9 @@ ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) - admin="john" (USER) - is_public=1 (PUBLIC|public=1|private=0) + domain="domain.tld" + path="/path" + admin="john" + is_public=1 ; Checks pkg_linter=1 setup_sub_dir=1 @@ -12,8 +12,6 @@ setup_private=1 setup_public=1 upgrade=1 - # 3.8.2~ynh2 - upgrade=1 from_commit=3bdecdeabdcaaf1fdfade6e5b7dcfa30704c665c # 3.10.2~ynh1 upgrade=1 from_commit=499ac857a9e80bbf56c93e448086e84e09e97ac6 backup_restore=1 @@ -23,7 +21,5 @@ Email= Notification=none ;;; Upgrade options - ; commit=3bdecdeabdcaaf1fdfade6e5b7dcfa30704c665c - name=3.8.2~ynh2 ; commit=499ac857a9e80bbf56c93e448086e84e09e97ac6 name=3.10.2~ynh1 \ No newline at end of file diff --git a/conf/app.src b/conf/app.src index 621f625..eb56b1d 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/moodle/moodle/archive/v3.10.3.zip -SOURCE_SUM=f92e603a261d013b1c6f2956d1511b7e5d65ac1e9f05de77a94183bc3faaba7d +SOURCE_URL=https://github.com/moodle/moodle/archive/v3.11.0.zip +SOURCE_SUM=03f878da9f4aeb10c0222d5f9addce7f6c64b216881221bcbac2fec8e34bde5a SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..1e932a1 --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,10 @@ +## Configuration + +How to configure this app: by an admin panel. + +## YunoHost specific features + +#### Multi-user support + +* Are LDAP and HTTP auth supported? **Yes** +* Can the app be used by multiple users? **Yes** diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..f8b8e3b --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1 @@ +- Cette app est intégrée avec le LDAP / SSO de Yunohost diff --git a/doc/screenshots/Moodle_2.0_on_Firefox_4.0.png b/doc/screenshots/Moodle_2.0_on_Firefox_4.0.png new file mode 100644 index 0000000..9f8e6ae Binary files /dev/null and b/doc/screenshots/Moodle_2.0_on_Firefox_4.0.png differ diff --git a/manifest.json b/manifest.json index f668490..d54ce1e 100644 --- a/manifest.json +++ b/manifest.json @@ -6,15 +6,22 @@ "en": "Online learning platform", "fr": "Plateforme d'apprentissage en ligne" }, - "version": "3.10.3~ynh1", + "version": "3.11.0~ynh1", "url": "https://moodle.org/", + "upstream": { + "license": "GPL-3.0-or-later", + "website": "https://moodle.org/", + "demo": "https://sandbox.moodledemo.net/", + "admindoc": "https://docs.moodle.org/311/en/Main_page", + "code": "https://github.com/moodle/moodle" + }, "license": "GPL-3.0-or-later", "maintainer": { "name": "Anmol Sharma", "email": "anmol@datamol.org" }, "requirements": { - "yunohost": ">= 4.1.7" + "yunohost": ">= 4.2.4" }, "multi_instance": true, "services": [ diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 6c28fc5..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,16 +0,0 @@ -## Problem -- *Description of why you made this PR* - -## Solution -- *And how do you fix that problem* - -## PR Status -- [ ] Code finished. -- [ ] Tested with Package_check. -- [ ] Fix or enhancement tested. -- [ ] Upgrade from last version tested. -- [ ] Can be reviewed and tested. - -## Package_check results ---- -* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/_common.sh b/scripts/_common.sh index 956370d..3730b16 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -19,19 +19,6 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-common php${YNH_PHP_VERSION}-mbstr # EXPERIMENTAL HELPERS #================================================= -# Execute a command as another user -# usage: exec_as USER COMMAND [ARG ...] -exec_as() { - local USER=$1 - shift 1 - - if [[ $USER = $(whoami) ]]; then - eval "$@" - else - sudo -u "$USER" "$@" - fi -} - #================================================= # FUTURE OFFICIAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 6afafdf..09f8c44 100644 --- a/scripts/backup +++ b/scripts/backup @@ -40,7 +40,7 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" -ynh_backup --src_path="$data_path" +ynh_backup --src_path="$data_path" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index 6f05f87..325ba44 100644 --- a/scripts/install +++ b/scripts/install @@ -50,6 +50,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 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=data_path --value=$data_path #================================================= # STANDARD MODIFICATIONS @@ -74,6 +75,14 @@ ynh_psql_setup_db --db_user=$db_user --db_name=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=2 + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -83,6 +92,10 @@ 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" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -91,14 +104,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=2 - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -114,17 +119,15 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) # SECURE FILES AND DIRECTORIES #================================================= -ynh_app_setting_set --app=$app --key=data_path --value=$data_path mkdir -p $data_path -chown -R $app: $data_path -chown -R $app: $final_path +chown -R $app:www-data $data_path #================================================= # SETUP APPLICATION #================================================= ynh_script_progression --message="Setting up the application..." --weight=190 -exec_as $app php${phpversion} "$final_path/admin/cli/install.php" --wwwroot="https://$domain${path_url%/}" --dataroot="$data_path" --dbtype='pgsql' --dbname="$db_name" --dbuser="$db_name" --dbpass="$db_pwd" --adminuser="$admin" --adminpass="$password" --adminemail="$email" --fullname="YunoHost" --shortname="YNH" --non-interactive --agree-license +ynh_exec_as $app php${phpversion} "$final_path/admin/cli/install.php" --wwwroot="https://$domain${path_url%/}" --dataroot="$data_path" --dbtype='pgsql' --dbname="$db_name" --dbuser="$db_name" --dbpass="$db_pwd" --adminuser="$admin" --adminpass="$password" --adminemail="$email" --fullname="YunoHost" --shortname="YNH" --non-interactive --agree-license # Calculate and store the config file checksum into the app settings ynh_store_file_checksum "$final_path/config.php" @@ -147,7 +150,7 @@ ynh_psql_execute_as_root --database="$db_name" --sql="UPDATE public.mdl_config_p # The admin is an ldap user ynh_psql_execute_as_root --database="$db_name" --sql="UPDATE public.mdl_user SET auth='ldap' WHERE username='$admin';" -exec_as $app php$phpversion "$final_path/admin/cli/purge_caches.php" +ynh_exec_as $app php$phpversion "$final_path/admin/cli/purge_caches.php" #================================================= # ADD CRON JOB @@ -156,17 +159,6 @@ ynh_script_progression --message="Adding cron job..." --weight=2 ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." --weight=1 - -# Set permissions to app files -chown -R $app: $data_path -chown -R $app: $final_path - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/restore b/scripts/restore index 1ca08a6..bdb931e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -52,6 +52,14 @@ ynh_script_progression --message="Restoring the NGINX configuration..." --weight ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -59,24 +67,13 @@ ynh_script_progression --message="Restoring Moodle main directory..." --weight=1 ynh_restore_file --origin_path=$final_path -ynh_restore_file --origin_path=$data_path - -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# RESTORE USER RIGHTS -#================================================= -ynh_script_progression --message="Restoring user rights..." +ynh_restore_file --origin_path=$data_path --not_mandatory # Restore permissions on app files -chown -R $app: $final_path -chown -R $app: $data_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chown -R $app:www-data $data_path #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 7cc7354..a47efdc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -60,6 +60,14 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=4 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -70,10 +78,29 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=6 +# Create a temporary directory + tmpdir="$(mktemp -d)" + + # Backup the config file in the temp dir + cp -a "$final_path/config.php" "$tmpdir/config.php" + + # Remove the app directory securely + ynh_secure_remove --file="$final_path" + # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" + + # Copy the admin saved settings from tmp directory to final path + cp -a "$tmpdir/config.php" "$final_path/config.php" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -89,14 +116,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=1 ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=4 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -106,27 +125,17 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 ynh_add_fpm_config --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -#================================================= -# SPECIFIC UPGRADE #================================================= # UPGRADING THE APPLICATION #================================================= -ynh_script_progression --message="Upgrading the application..." --weight=1 +# ynh_script_progression --message="Upgrading the application..." --weight=1 -ynh_backup_if_checksum_is_different --file="$final_path/config.php" +# ynh_backup_if_checksum_is_different --file="$final_path/config.php" -exec_as $app php${phpversion} "$final_path/admin/cli/upgrade.php" --non-interactive +# ynh_exec_as $app php${phpversion} "$final_path/admin/cli/upgrade.php" --non-interactive -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$final_path/config.php" - -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chown -R $app: $data_path -chown -R $app: $final_path +# # Recalculate and store the checksum of the file for the next upgrade. +# ynh_store_file_checksum --file="$final_path/config.php" #================================================= # ACTIVATE LDAP SUPPORT @@ -146,7 +155,7 @@ ynh_psql_execute_as_root --database="$db_name" --sql="UPDATE public.mdl_config_p # The admin is an ldap user ynh_psql_execute_as_root --database="$db_name" --sql="UPDATE public.mdl_user SET auth='ldap' WHERE username='$admin';" -exec_as $app php${phpversion} "$final_path/admin/cli/purge_caches.php" +ynh_exec_as $app php${phpversion} "$final_path/admin/cli/purge_caches.php" #================================================= # ADD CRON JOB @@ -155,16 +164,7 @@ ynh_script_progression --message="Adding cron job..." --weight=4 ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." --weight=1 - -# Set permissions on app files -chown -R $app: $data_path -chown -R $app: $final_path +chown -R $app:www-data "$final_path" #================================================= # RELOAD NGINX