1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/moodle_ynh.git synced 2024-09-03 19:46:23 +02:00

Add change url (#38)

* Update change_url
This commit is contained in:
Éric Gaspar 2021-04-04 19:20:08 +02:00 committed by GitHub
parent dfb0a17dc4
commit d8695144de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 188 additions and 9 deletions

View file

@ -3,15 +3,15 @@
[![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) [![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)
[![Install Moodle with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=moodle) [![Install Moodle with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=moodle)
*[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.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## 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](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.
Moodle is widely used around the world by universities, schools, companies and all manner of organisations and individuals. **Shipped version:** 3.10.3
**Shipped version:** 3.10.2
## Screenshots ## Screenshots

62
README_fr.md Normal file
View file

@ -0,0 +1,62 @@
# Moodle pour 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)
[![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)*
> *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.*
## 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
## Captures d'écran
![](https://upload.wikimedia.org/wikipedia/commons/3/36/Moodle_2.0_on_Firefox_4.0.png)
## Démo
* [Démo officielle](https://sandbox.moodledemo.net/)
## Configuration
How to configure this app: by an admin panel.
## 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%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/moodle/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/moodle%20%28Apps%29.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/
---
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/moodle_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/moodle_ynh/tree/testing --debug
ou
sudo yunohost app upgrade moodle -u https://github.com/YunoHost-Apps/moodle_ynh/tree/testing --debug
```

View file

@ -14,13 +14,16 @@
upgrade=1 upgrade=1
# 3.8.2~ynh2 # 3.8.2~ynh2
upgrade=1 from_commit=3bdecdeabdcaaf1fdfade6e5b7dcfa30704c665c upgrade=1 from_commit=3bdecdeabdcaaf1fdfade6e5b7dcfa30704c665c
# 3.10.2~ynh1
upgrade=1 from_commit=499ac857a9e80bbf56c93e448086e84e09e97ac6
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0 change_url=1
change_url=0
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
;;; Upgrade options ;;; Upgrade options
; commit=3bdecdeabdcaaf1fdfade6e5b7dcfa30704c665c ; commit=3bdecdeabdcaaf1fdfade6e5b7dcfa30704c665c
name=3.8.2~ynh2 name=3.8.2~ynh2
; commit=499ac857a9e80bbf56c93e448086e84e09e97ac6
name=3.10.2~ynh1

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/moodle/moodle/archive/v3.10.2.zip SOURCE_URL=https://github.com/moodle/moodle/archive/v3.10.3.zip
SOURCE_SUM=6c54328ca6c40fb5cb4eb66a449b3c5fe7fe03bb04ab21df1156ba3c9c2ed1c6 SOURCE_SUM=f92e603a261d013b1c6f2956d1511b7e5d65ac1e9f05de77a94183bc3faaba7d
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -6,7 +6,7 @@
"en": "Online learning platform", "en": "Online learning platform",
"fr": "Plateforme d'apprentissage en ligne" "fr": "Plateforme d'apprentissage en ligne"
}, },
"version": "3.10.2~ynh1", "version": "3.10.3~ynh1",
"url": "https://moodle.org/", "url": "https://moodle.org/",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {

114
scripts/change_url Normal file
View file

@ -0,0 +1,114 @@
#!/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=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# 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..." --weight=1
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
#=================================================
# SETUP APPLICATION
#=================================================
ynh_script_progression --message="Setting up the application..." --weight=3
ynh_replace_string --match_string="\$CFG->wwwroot = '*';" --replace_string="\$CFG->wwwroot = 'https://$new_domain${new_path%/}';" --target_file=$final_path/config.php
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last