1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-20 02:52:11 +00:00

Changed install logic to look at config.php and not version.php for database version number

This commit is contained in:
Jeff Volkenant 2019-08-23 13:21:06 -07:00
parent c5b2dd9e36
commit 6bbdd75b09

View File

@ -90,11 +90,20 @@ InstallNextcloud() {
fi fi
} }
# Nextcloud Version to install. Checks are done down below to step through intermediate versions.
nextcloud_ver=15.0.8 nextcloud_ver=15.0.8
nextcloud_hash=4129d8d4021c435f2e86876225fb7f15adf764a3 nextcloud_hash=4129d8d4021c435f2e86876225fb7f15adf764a3
# Check if Nextcloud dir exist, and check if version matches nextcloud_ver (if either doesn't - install/upgrade)
if [ ! -d /usr/local/lib/owncloud/ ] \ # Current Nextcloud Version, #1623
|| ! grep -q $nextcloud_ver /usr/local/lib/owncloud/version.php; then # Checking /usr/local/lib/owncloud/version.php shows version of the Nextcloud application, not the DB
# $STORAGE_ROOT/owncloud is kept together even during a backup. It is better to rely on config.php than
# version.php since the restore procedure can leave the system in a state where you have a newer Nextcloud
# application version than the database.
CURRENT_NEXTCLOUD_VER=$(php -r "include(\"$STORAGE_ROOT/owncloud/config.php\"); echo(\$CONFIG['version']);")
# If the Nextcloud directory is missing (never been installed before, or the nextcloud version to be installed is different
# from the version currently installed, do the install/upgrade
if [ ! -d /usr/local/lib/owncloud/ ] || [[ ! $nextcloud_ver =~ ^${CURRENT_NEXTCLOUD_VER} ]]; then
# Stop php-fpm if running. If theyre not running (which happens on a previously failed install), dont bail. # Stop php-fpm if running. If theyre not running (which happens on a previously failed install), dont bail.
service php7.2-fpm stop &> /dev/null || /bin/true service php7.2-fpm stop &> /dev/null || /bin/true
@ -115,25 +124,21 @@ if [ ! -d /usr/local/lib/owncloud/ ] \
fi fi
# If ownCloud or Nextcloud was previously installed.... # If ownCloud or Nextcloud was previously installed....
if [ -e /usr/local/lib/owncloud/version.php ]; then if [ ! -z ${CURRENT_NEXTCLOUD_VER} ]; then
# Database migrations from ownCloud are no longer possible because ownCloud cannot be run under # Database migrations from ownCloud are no longer possible because ownCloud cannot be run under
# PHP 7. # PHP 7.
if grep -q "OC_VersionString = '[89]\." /usr/local/lib/owncloud/version.php; then if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^[89] ]]; then
echo "Upgrades from Mail-in-a-Box prior to v0.28 (dated July 30, 2018) with Nextcloud < 13.0.6 (you have ownCloud 8 or 9) are not supported. Upgrade to Mail-in-a-Box version v0.30 first. Setup aborting." echo "Upgrades from Mail-in-a-Box prior to v0.28 (dated July 30, 2018) with Nextcloud < 13.0.6 (you have ownCloud 8 or 9) are not supported. Upgrade to Mail-in-a-Box version v0.30 first. Setup aborting."
exit 1 exit 1
fi elif [[ ${CURRENT_NEXTCLOUD_VER} =~ ^1[012] ]]; then
if grep -q "OC_VersionString = '1[012]\." /usr/local/lib/owncloud/version.php; then
echo "Upgrades from Mail-in-a-Box prior to v0.28 (dated July 30, 2018) with Nextcloud < 13.0.6 (you have ownCloud 10, 11 or 12) are not supported. Upgrade to Mail-in-a-Box version v0.30 first. Setup aborting." echo "Upgrades from Mail-in-a-Box prior to v0.28 (dated July 30, 2018) with Nextcloud < 13.0.6 (you have ownCloud 10, 11 or 12) are not supported. Upgrade to Mail-in-a-Box version v0.30 first. Setup aborting."
exit 1 exit 1
fi elif [[ ${CURRENT_NEXTCLOUD_VER} =~ ^13 ]]; then
# If we are running Nextcloud 13, upgrade to Nextcloud 14 # If we are running Nextcloud 13, upgrade to Nextcloud 14
if grep -q "OC_VersionString = '13\." /usr/local/lib/owncloud/version.php; then
InstallNextcloud 14.0.6 4e43a57340f04c2da306c8eea98e30040399ae5a InstallNextcloud 14.0.6 4e43a57340f04c2da306c8eea98e30040399ae5a
elif [[ ${CURRENT_NEXTCLOUD_VER} =~ ^14 ]]; then
fi
# During the upgrade from Nextcloud 14 to 15, user_external may cause the upgrade to fail. # During the upgrade from Nextcloud 14 to 15, user_external may cause the upgrade to fail.
# We will disable it here before the upgrade and install it again after the upgrade. # We will disable it here before the upgrade and install it again after the upgrade.
if grep -q "OC_VersionString = '14\." /usr/local/lib/owncloud/version.php; then
hide_output sudo -u www-data php /usr/local/lib/owncloud/console.php app:disable user_external hide_output sudo -u www-data php /usr/local/lib/owncloud/console.php app:disable user_external
fi fi
fi fi