Skip to content

handle format_topcoll + enhance readme #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ To automate __our environment__ we wrote this bash script. It may won't work in
## Setup
1. Clone this repository.
1. Make the script executable (if not cloned): `chmod +x moodle-update`
1. Go to your web directory: `cd /var/www`
1. Rename the moodle directory to: `moodle_x.y` like `moodle_4.01`
1. Create a link to this directory with the absolute path: `ln -s /var/www/moodle_4.01 moodle`
1. Tell your web server to serve `/var/www/moodle`.


### Config
Expand All @@ -14,9 +18,9 @@ The script creates a `settings.conf` file for a standard Debian/Ubuntu Linux.


## Usage options
- Without any parameter: `./update-moodle`
- With new version: `./update-moodle 3.9`
- With new version + explicit download file: `./update-moodle 3.9 https://example.com/moodle-3.9.21.zip`
- Without any parameter: `./moodle-update`
- With new version: `./moodle-update 3.9`
- With new version + explicit download file: `./moodle-update 3.9 https://example.com/moodle-3.9.21.zip`


### Important information for Moodle 4
Expand Down
104 changes: 104 additions & 0 deletions moodle-update
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,88 @@ printf "\n%-30s %s" "previous plugins" ": "
# print array
printf "${LIGHTCYAN}%d${NC}\n" "${#PLUGIN_DIFF_ARRAY[*]}"


# check if minor version changes
if test ! "$MOODLE_VERSION_NEXT" = "$MOODLE_VERSION_NOW"
then
# boost_union detection
if test -d "$BACKUP_PATH/theme/boost_union/"
then
echo " "
printf "${LIGHTRED}%-30s${NC}\n" "boost_union detected"

# suggest urls from: https://moodle.org/plugins/theme_boost_union/versions
if test $MOODLE_VERSION_NEXT = "4.00"
then
printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/29678/theme_boost_union_moodle40_2022080940.zip"
elif test $MOODLE_VERSION_NEXT = "4.01"
then
printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33570/theme_boost_union_moodle41_2023010570.zip"
elif test $MOODLE_VERSION_NEXT = "4.02"
then
printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33569/theme_boost_union_moodle42_2023090147.zip"
elif test $MOODLE_VERSION_NEXT = "4.03"
then
printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33565/theme_boost_union_moodle43_2023102044.zip"
elif test $MOODLE_VERSION_NEXT = "4.04"
then
printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33590/theme_boost_union_moodle44_2024060103.zip"
elif test $MOODLE_VERSION_NEXT = "4.05"
then
printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33573/theme_boost_union_moodle45_2024100700.zip"
else
printf "%-30s %s\n" "get a download url from" ": https://moodle.org/plugins/theme_boost_union/versions"
fi

printf "${ORANGE}%-30s${NC} %s" "enter download url" ": "
read -r PLUGIN_BOOST_UNION_URL

printf "%-30s %s" "boost_union download" ": "
wget --quiet $PLUGIN_BOOST_UNION_URL -O /tmp/boost_union.zip
checkstatus
echo " "
fi

# format_topcoll detection
if test -d "$BACKUP_PATH/course/format/topcoll/"
then
echo " "
printf "${LIGHTRED}%-30s${NC}\n" "format_topcoll detected"

# suggest urls from: https://moodle.org/plugins/format_topcoll/versions
if test $MOODLE_VERSION_NEXT = "4.00"
then
printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/29774/format_topcoll_moodle40_2022041703.zip"
elif test $MOODLE_VERSION_NEXT = "4.01"
then
printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/29775/format_topcoll_moodle41_2022112602.zip"
elif test $MOODLE_VERSION_NEXT = "4.02"
then
printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/29776/format_topcoll_moodle42_2023042401.zip"
elif test $MOODLE_VERSION_NEXT = "4.03"
then
printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/31376/format_topcoll_moodle43_2023100701.zip"
elif test $MOODLE_VERSION_NEXT = "4.04"
then
printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33218/format_topcoll_moodle44_2024032804.zip"
elif test $MOODLE_VERSION_NEXT = "4.05"
then
printf "%-30s %s\n" "suggested url" ": https://moodle.org/plugins/download.php/33614/format_topcoll_moodle45_2024092200.zip"
else
printf "%-30s %s\n" "get a download url from" ": https://moodle.org/plugins/format_topcoll/versions"
fi

printf "${ORANGE}%-30s${NC} %s" "enter download url" ": "
read -r PLUGIN_FORMAT_TOPCOLL_URL

printf "%-30s %s" "format_topcoll download" ": "
wget --quiet $PLUGIN_FORMAT_TOPCOLL_URL -O /tmp/format_topcoll.zip
checkstatus
echo " "
fi
fi


# choose copy mode
until test "$COPYALL" = "y" -o "$COPYALL" = "n"
do
Expand Down Expand Up @@ -507,6 +589,28 @@ printf "\n%-30s %s" "previous plugins" ": "

cp -r $BACKUP_PATH/$PLUGIN_PATH/ $MOODLE_NEXT_PATH/${PLUGIN_PATH%/*}


# check if minor version changes
if test ! "$MOODLE_VERSION_NEXT" = "$MOODLE_VERSION_NOW"
then
# copy format_topcoll
if test "$PLUGIN_PATH" = "course/format/topcoll"
then
rm -r $MOODLE_NEXT_PATH/course/format/topcoll
unzip -q /tmp/format_topcoll.zip -d $MOODLE_NEXT_PATH/course/format/
rm /tmp/format_topcoll.zip
fi

# copy boost_union
if test "$PLUGIN_PATH" = "theme/boost_union"
then
rm -r $MOODLE_NEXT_PATH/theme/boost_union
unzip -q /tmp/boost_union.zip -d $MOODLE_NEXT_PATH/theme/
rm /tmp/boost_union.zip
fi
fi


if test "$COPYALL" = "y"
then
printf "%-46s %s" "Copy $PLUGIN_PATH" ": "
Expand Down