3 # updates the moodle install, assuming all paths are at the default.
5 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
8 # some constants that we know are not really.
9 moodle_parent=/var/www/html
10 # parent directory is one level up from where moodle lives.
12 # this variable is just the directory name for moodle itself, not a path.
13 moodle_release=moodle-3.9
14 # the name of the release we're expecting to download and install
15 download_url="https://download.moodle.org/download.php/direct/stable39/${moodle_release}.tgz"
16 # where we can get the latest version of moodle for our chosen releases.
19 # everything below should be version invariant.
21 moodle_path="$moodle_parent/$moodle_dir"
22 # composing the parent plus directory name should get us to moodle.
24 if [ ! -d "$moodle_path" ]; then
25 echo "There was no moodle installation found at: $moodle_path"
29 # where we unpack our temporary stuff.
30 temp_install="$(mktemp -d /tmp/update_moodle.XXXXXX)"
31 #echo temp install dir is: $temp_install
32 if [ ! -d "$temp_install" ]; then
33 echo The temporary installation directory at: $temp_install could not be created.
37 # quit the running moodle instance.
39 exit_on_error stopping httpd process before moodle upgrade.
41 # jump into our new work area.
44 # get the latest moodle version. this could change over time,
45 # but it's the best link i could find.
47 exit_on_error downloading latest version of moodle.
49 # use the feisty meow unpack script to extract the moodle data.
50 unpack "${moodle_release}.tgz"
51 exit_on_error unpacking latest version of moodle.
53 # rename the old moodle directory to a unique name in the same area.
54 old_moodle_path="$moodle_parent/moodle-$(basename $temp_install)"
55 mv "$moodle_parent/$moodle_dir" "$old_moodle_path"
56 exit_on_error renaming old version of moodle.
58 # move the new stuff into place.
59 mv "${moodle_release}/$moodle_dir" "$moodle_parent"/
60 exit_on_error moving new version of moodle into place.
62 # grab our important configuration files and put them back in the new directory.
63 cp "$old_moodle_path/config.php" "$moodle_path"
64 exit_on_error copying existing moodle configuration file: config.php
68 NOTE: This script does not copy any plugins or themes. If you are using\n\
69 updated or specialized additions to moodle, please copy them from here:\n\
71 into the new install at:\n\
76 # restart the running moodle instance.
78 exit_on_error starting httpd process after moodle upgrade.
80 # sunshine and roses! we are through the gauntlet.