From cf1f4b69b8451e866b63c59a4fb6954b32035d01 Mon Sep 17 00:00:00 2001
From: "m.lorini" <marco.lorini@garr.it>
Date: Fri, 6 Dec 2019 16:47:37 +0100
Subject: [PATCH] 2019-12-06 Update to moodle-3.8

---
 README.md                        |  6 ++--
 config.yaml                      |  2 +-
 hooks/config-changed             | 52 ++++++++++++++++----------------
 hooks/mysql-db-relation-broken   |  0
 hooks/mysql-db-relation-changed  |  2 +-
 hooks/mysql-db-relation-departed |  0
 hooks/pgsql-db-relation-broken   |  0
 hooks/pgsql-db-relation-changed  |  2 +-
 hooks/pgsql-db-relation-departed |  0
 metadata.yaml                    |  2 +-
 revision                         |  2 +-
 11 files changed, 34 insertions(+), 34 deletions(-)
 mode change 100644 => 100755 hooks/mysql-db-relation-broken
 mode change 100644 => 100755 hooks/mysql-db-relation-changed
 mode change 100644 => 100755 hooks/mysql-db-relation-departed
 mode change 100644 => 100755 hooks/pgsql-db-relation-broken
 mode change 100644 => 100755 hooks/pgsql-db-relation-changed
 mode change 100644 => 100755 hooks/pgsql-db-relation-departed

diff --git a/README.md b/README.md
index 97a8d33..82e0084 100755
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # Overview
 
-Moodle is a learning platform designed to provide educators, administrators and learners with a single robust, secure and integrated system to create personalised learning environments. This charm deploys Moodle 3.3 (using git://git.moodle.org/moodle.git as source) as outlined by the Moodle Installation Guide.
+Moodle is a learning platform designed to provide educators, administrators and learners with a single robust, secure and integrated system to create personalised learning environments. This charm deploys Moodle  (using git://git.moodle.org/moodle.git as source) as outlined by the Moodle Installation Guide.
 
 # Usage
 
@@ -55,7 +55,7 @@ If you enable this feature a cron job will be installed, and every night checks
     juju config moodle auto-update=true
     
 ##Branch
-It refers to Moodle git branch. By default this charm checkouts MOODLE_34_STABLE branch, but you can upgrade your Moodle installation by setting this charm option
+It refers to Moodle git branch. By default this charm checkouts MOODLE_35_STABLE branch, but you can upgrade your Moodle installation by setting this charm option
 
     juju config moodle branch=MOODLE_XY_STABLE
     
@@ -71,5 +71,5 @@ Moodle needs to send e-mail notifications to users. You can set up your outgoing
 
 # Contact Information
 
-csd-support@garr.it
+cloud-support@garr.it
 
diff --git a/config.yaml b/config.yaml
index 1f01bdd..752d8ae 100644
--- a/config.yaml
+++ b/config.yaml
@@ -4,7 +4,7 @@ options:
     type: string
     description: The FQDN to access Moodle on (without HTTP protocol. E.g. www.example.com)
   branch:
-    default: "MOODLE_34_STABLE"
+    default: "MOODLE_38_STABLE"
     type: string
     description: Moodle git branch to install or upgrade
   datadir:
diff --git a/hooks/config-changed b/hooks/config-changed
index 63d6ce9..087686d 100755
--- a/hooks/config-changed
+++ b/hooks/config-changed
@@ -63,15 +63,15 @@ if [ -f $WWWROOT/config.php ]; then
 
     OLD_DATADIR=`cat $WWWROOT/config.php | grep dataroot | awk '{print $3}' | cut -d "'" -f 2`
     if [ "$OLD_DATADIR" != "$DATADIR" ]; then
-	juju-log "Changing Moodle data dir"
-	mkdir -p $DATADIR
-	mv $OLD_DATADIR/* $DATADIR
-	chown -R root $DATADIR
-	chgrp -R www-data $DATADIR
-	chmod -R 02770 $DATADIR
-	STR_OLD=`cat $WWWROOT/config.php | grep dataroot`
-	STR_NEW="\$CFG->dataroot = '$DATADIR';"
-	sed -i "s|$STR_OLD|$STR_NEW|g" $WWWROOT/config.php
+    juju-log "Changing Moodle data dir"
+    mkdir -p $DATADIR
+    mv $OLD_DATADIR/* $DATADIR
+    chown -R root $DATADIR
+    chgrp -R www-data $DATADIR
+    chmod -R 02770 $DATADIR
+    STR_OLD=`cat $WWWROOT/config.php | grep dataroot`
+    STR_NEW="\$CFG->dataroot = '$DATADIR';"
+    sed -i "s|$STR_OLD|$STR_NEW|g" $WWWROOT/config.php
     fi
 fi
 
@@ -154,23 +154,23 @@ fi
 if [ ! -z "$MPM_TYPE" ]; then
     juju-log "Configure Apache MPM"
     if ( echo "mpm_prefork mpm_event mpm_worker" | grep -w $MPM_TYPE ); then
-	for atype in mpm_prefork mpm_event mpm_worker ; do
-	    if [ "$atype" != "$MPM_TYPE" ]; then
-	        a2dismod $atype
-	    fi
-	done
-	for atype in mpm_prefork mpm_event mpm_worker ; do
-	    if [ "$atype" == "$MPM_TYPE" ]; then
-		a2enmod $atype
-		set -f
-		mpmCfgArray=(${MPM_CONFIG//,/ })
-		for elemArray in "${mpmCfgArray[@]}" ; do
-		    elemKey=$(echo $elemArray | cut -f1 -d=)
-		    elemVal=$(echo $elemArray | cut -f2 -d=)
-		    sed -i "s|^\(\s\+\)$elemKey.*|\1 $elemKey  $elemVal|g" /etc/apache2/mods-available/${MPM_TYPE}.conf
-		done
-	    fi
-	done
+    for atype in mpm_prefork mpm_event mpm_worker ; do
+        if [ "$atype" != "$MPM_TYPE" ]; then
+            a2dismod $atype
+        fi
+    done
+    for atype in mpm_prefork mpm_event mpm_worker ; do
+        if [ "$atype" == "$MPM_TYPE" ]; then
+        a2enmod $atype
+        set -f
+        mpmCfgArray=(${MPM_CONFIG//,/ })
+        for elemArray in "${mpmCfgArray[@]}" ; do
+            elemKey=$(echo $elemArray | cut -f1 -d=)
+            elemVal=$(echo $elemArray | cut -f2 -d=)
+            sed -i "s|^\(\s\+\)$elemKey.*|\1 $elemKey  $elemVal|g" /etc/apache2/mods-available/${MPM_TYPE}.conf
+        done
+        fi
+    done
     fi
 fi
 
diff --git a/hooks/mysql-db-relation-broken b/hooks/mysql-db-relation-broken
old mode 100644
new mode 100755
diff --git a/hooks/mysql-db-relation-changed b/hooks/mysql-db-relation-changed
old mode 100644
new mode 100755
index f650b2f..ccb4aea
--- a/hooks/mysql-db-relation-changed
+++ b/hooks/mysql-db-relation-changed
@@ -66,7 +66,7 @@ else
 
         #Execute CLI Moodle installer
 	juju-log "Database population"
-	/usr/bin/php $WWWROOT/admin/cli/install.php --lang=it --wwwroot=$HTTP_PROT://$DNS_NAME --dataroot=$DATADIR --dbtype=mysqli --dbhost=$db_host --dbname=$db_db --dbuser=$db_user --dbpass=$db_pass --prefix=mdl --fullname="$FULLNAME" --shortname="$SHORTNAME" --adminuser=$MDL_ADMIN --adminpass=$MDL_ADMINPASS --chmod=2770 --non-interactive --agree-license
+	/usr/bin/php $WWWROOT/admin/cli/install.php --lang=en --wwwroot=$HTTP_PROT://$DNS_NAME --dataroot=$DATADIR --dbtype=mysqli --dbhost=$db_host --dbname=$db_db --dbuser=$db_user --dbpass=$db_pass --prefix=mdl --fullname="$FULLNAME" --shortname="$SHORTNAME" --adminuser=$MDL_ADMIN --adminpass=$MDL_ADMINPASS --chmod=2770 --non-interactive --agree-license
 	
 	#Remove install dir for security
 	rm -r $WWWROOT/install
diff --git a/hooks/mysql-db-relation-departed b/hooks/mysql-db-relation-departed
old mode 100644
new mode 100755
diff --git a/hooks/pgsql-db-relation-broken b/hooks/pgsql-db-relation-broken
old mode 100644
new mode 100755
diff --git a/hooks/pgsql-db-relation-changed b/hooks/pgsql-db-relation-changed
old mode 100644
new mode 100755
index 2ddcf47..0ba3aaa
--- a/hooks/pgsql-db-relation-changed
+++ b/hooks/pgsql-db-relation-changed
@@ -66,7 +66,7 @@ else
 
         #Execute CLI Moodle installer
 	juju-log "Database population"
-	/usr/bin/php $WWWROOT/admin/cli/install.php --lang=it --wwwroot=$HTTP_PROT://$DNS_NAME --dataroot=$DATADIR --dbtype=pgsql --dbhost=$db_host --dbname=$db_db --dbuser=$db_user --dbpass=$db_pass --prefix=mdl --fullname="$FULLNAME" --shortname="$SHORTNAME" --adminuser=$MDL_ADMIN --adminpass=$MDL_ADMINPASS --chmod=2770 --non-interactive --agree-license
+	/usr/bin/php $WWWROOT/admin/cli/install.php --lang=en --wwwroot=$HTTP_PROT://$DNS_NAME --dataroot=$DATADIR --dbtype=pgsql --dbhost=$db_host --dbname=$db_db --dbuser=$db_user --dbpass=$db_pass --prefix=mdl --fullname="$FULLNAME" --shortname="$SHORTNAME" --adminuser=$MDL_ADMIN --adminpass=$MDL_ADMINPASS --chmod=2770 --non-interactive --agree-license
 	
 	#Remove install dir for security
 	rm -r $WWWROOT/install
diff --git a/hooks/pgsql-db-relation-departed b/hooks/pgsql-db-relation-departed
old mode 100644
new mode 100755
diff --git a/metadata.yaml b/metadata.yaml
index 014d19a..1e30122 100644
--- a/metadata.yaml
+++ b/metadata.yaml
@@ -1,6 +1,6 @@
 name: moodle
 summary: Moodle is a free open-source LMF for e-Learning.
-maintainer: Gianni Marzulli <gianni.marzulli@garr.it>
+maintainer: GARR Cloud <cloud-support@garr.it>
 description: |
   Moodle is a learning platform designed to provide educators, administrators and learners with a single robust, secure and integrated system to create personalised learning environments.
   This charm deploys Moodle as outlined by the Moodle Installation Guide.
diff --git a/revision b/revision
index ec63514..7813681 100644
--- a/revision
+++ b/revision
@@ -1 +1 @@
-9
+5
\ No newline at end of file
-- 
GitLab