Skip to content

Commit

Permalink
add case for downgrade, include warning that downgrade of moodle may …
Browse files Browse the repository at this point in the history
…fail
  • Loading branch information
JannikBadenhop committed Jul 22, 2024
1 parent 21e561f commit f2a2974
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/init/updateCheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ main() {
image_version="$APP_VERSION"

comp_result="$(compare_semver "$installed_version" "$image_version")"
if [ ! -f "${moodle_path}/version.php" ]; then
if [[ -z "$comp_result" ]]; then
MODULE="dbp-update" info "No installed Moodle version detected, continuing with fresh install"
exit 0
fi
Expand All @@ -75,7 +75,13 @@ main() {
MODULE="dbp-update" info "Installed version ${installed_version} is same as image version ${image_version}"
exit 0
fi
MODULE="dbp-update" info "Starting update of installed version ${installed_version} to ${image_version}"

if [[ "$comp_result" == 1 ]]; then
MODULE="dbp-update" info "Starting update of installed version ${installed_version} to ${image_version}"
else
MODULE="dbp-update" warn "Starting downgrade of installed version ${installed_version} to ${image_version}"
MODULE="dbp-update" warn "This may not work and leave the database in an inconsistent state"
fi
MODULE="dbp-update" info "Creating local backup"
create_backup
MODULE="dbp-update" info "Unpacking new moodle version"
Expand Down

0 comments on commit f2a2974

Please sign in to comment.