Skip to content

Commit 80bfd76

Browse files
authored
Fix bug in upgrade logic (hestiacp#3330)
* Fix upgrade logic bug * Improve version check jq -r .version /usr/share/phpmyadmin/package.json will not break if system accidentally upgrades to an older version (pre 1.3 installs)
1 parent 09a811a commit 80bfd76

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

func/upgrade.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,8 @@ upgrade_phppgadmin() {
578578
upgrade_phpmyadmin() {
579579
# Check if MariaDB/MySQL is installed on the server before attempting to install or upgrade phpMyAdmin
580580
if [ -n "$(echo $DB_SYSTEM | grep -w 'mysql')" ]; then
581-
pma_release_file=$(ls /usr/share/phpmyadmin/RELEASE-DATE-* 2> /dev/null | tail -n 1)
582-
if version_ge "${pma_release_file##*-}" "$pma_v"; then
581+
pma_version=$(jq -r .version /usr/share/phpmyadmin/package.json)
582+
if version_ge "$pma_version" "$pma_v"; then
583583
echo "[ * ] phpMyAdmin is up to date (${pma_release_file##*-})..."
584584
# Update permissions
585585
if [ -e /var/lib/phpmyadmin/blowfish_secret.inc.php ]; then
@@ -634,7 +634,7 @@ upgrade_filemanager() {
634634
else
635635
fm_version="1.0.0"
636636
fi
637-
if version_ge "$fm_version" "$fm_v"; then
637+
if ! version_ge "$fm_version" "$fm_v"; then
638638
echo "[ ! ] Upgrading File Manager to version $fm_v..."
639639
# Reinstall the File Manager
640640
$BIN/v-delete-sys-filemanager quiet yes
@@ -662,7 +662,7 @@ upgrade_roundcube() {
662662
echo " To upgrade to the latest version of Roundcube directly from upstream, from please run the command migrate_roundcube.sh located in: /usr/local/hestia/install/upgrade/manual/"
663663
else
664664
rc_version=$(cat /var/lib/roundcube/index.php | grep -o -E '[0-9].[0-9].[0-9]+' | head -1)
665-
if version_ge "$rc_version" "$rc_v"; then
665+
if ! version_ge "$rc_version" "$rc_v"; then
666666
echo "[ ! ] Upgrading Roundcube to version $rc_v..."
667667
$BIN/v-add-sys-roundcube
668668
else
@@ -675,7 +675,7 @@ upgrade_roundcube() {
675675
upgrade_rainloop() {
676676
if [ -n "$(echo "$WEBMAIL_SYSTEM" | grep -w 'rainloop')" ]; then
677677
rl_version=$(cat /var/lib/rainloop/data/VERSION)
678-
if version_ge "$rl_version" "$rl_v"; then
678+
if ! version_ge "$rl_version" "$rl_v"; then
679679
echo "[ ! ] Upgrading Rainloop to version $rl_v..."
680680
$BIN/v-add-sys-rainloop
681681
else

0 commit comments

Comments
 (0)