Skip to content
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
46 changes: 18 additions & 28 deletions scripts/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut
ynh_script_progression "Upgrading source files..."

# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="composer.json composer.lock config/ logs/ plugins/ vendor/"

chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
Expand All @@ -50,17 +50,6 @@ ynh_config_add_phpfpm
# Create a dedicated NGINX config
ynh_config_add_nginx

#=================================================
# CONFIGURE ROUNDCUBE
#=================================================
ynh_script_progression "Reconfiguring Roundcube..."

timezone=$(cat /etc/timezone)
ynh_app_setting_set_default --key="timezone" --value="$timezone"

deskey=$(ynh_string_random --length=24)
ynh_config_add --template="config.inc.php" --destination="$install_dir/config/config.inc.php"

#=================================================
# UPDATE DEPENDENCIES WITH COMPOSER
#=================================================
Expand All @@ -72,26 +61,26 @@ if [ -f "$install_dir/composer.lock" ]; then
fi

# Install composer.json
cp "$install_dir/composer.json-dist" "$install_dir/composer.json"
#cp "$install_dir/composer.json-dist" "$install_dir/composer.json"

chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#chmod -R o-rwx "$install_dir"
#chown -R $app:www-data "$install_dir"

# Upgrade composer itself
ynh_composer_exec install --no-dev
#ynh_composer_exec install --no-dev

# Check if dependencies need to be updated with Composer
#if [ -f "$install_dir/composer.json" ]
#then
# ynh_composer_exec update
# # Update plugin-installer for Composer version 2.0
# ynh_composer_exec require roundcube/plugin-installer:>=0.2.0
#else
# # Install composer.json
# cp "$install_dir/composer.json-dist" "$install_dir/composer.json"
# chmod -R o-rwx "$install_dir"
# chown -R $app:www-data "$install_dir"
#fi
if [ -f "$install_dir/composer.json" ]
then
ynh_composer_exec update
# Update plugin-installer for Composer version 2.0
# ynh_composer_exec require roundcube/plugin-installer:>=0.2.0
else
# Install composer.json
cp "$install_dir/composer.json-dist" "$install_dir/composer.json"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
fi

#=================================================
# UPGRADE ADDITIONAL PLUGINS
Expand Down Expand Up @@ -162,7 +151,8 @@ ynh_replace --match="^\s*// installed plugins" --replace="&\n $installed_plugins

# Update JavaScript dependencies
pushd "$install_dir"
COMPOSER_ALLOW_SUPERUSER=1 ynh_hide_warnings "php$php_version" ./bin/update.sh --version="?" -y <<< ""
COMPOSER_ALLOW_SUPERUSER=1 ynh_hide_warnings "php$php_version" ./bin/update.sh --version="?" -y <<< ""
COMPOSER_ALLOW_SUPERUSER=1 ynh_hide_warnings "php$php_version" -q ./bin/install-jsdeps.sh -v

# Store the config file checksum into the app settings
ynh_store_file_checksum "$install_dir/config/config.inc.php"
Expand Down
2 changes: 1 addition & 1 deletion tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ test_format = 1.0
args.with_carddav = 1


#test_upgrade_from.255335f9e9a001d5abec7192f07d168e30b3c3fb.name = "1.6.0~ynh3"
test_upgrade_from.255335f9e9a001d5abec7192f07d168e30b3c3fb.name = "1.6.0~ynh3"