79 lines
2.8 KiB
Bash
Executable File
79 lines
2.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression "Upgrading source files..."
|
|
|
|
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep=".env public/storage"
|
|
|
|
#=================================================
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression "Upgrading system configurations related to $app..."
|
|
|
|
ynh_config_add_phpfpm
|
|
|
|
ynh_config_add_nginx
|
|
|
|
ynh_config_add --template="cron" --destination="/etc/cron.d/$app"
|
|
|
|
#=================================================
|
|
# ENSURE BACKWARD COMPATIBILITY
|
|
#=================================================
|
|
ynh_script_progression "Ensuring backward compatibility..."
|
|
|
|
# Delete deprecated `firstname`/`lastname` settings. See upstream https://github.com/YunoHost/yunohost/pull/1516
|
|
ynh_app_setting_delete --key=email_firstname
|
|
ynh_app_setting_delete --key=email_lastname
|
|
ynh_app_setting_delete --key=email # also delete unnecessary duplicate of state storage
|
|
|
|
# Retrieve `$admin` user settings
|
|
email_fullname="$(ynh_user_get_info --username=$admin --key=fullname)"
|
|
email="$(ynh_user_get_info --username=$admin --key=mail)"
|
|
|
|
#=================================================
|
|
# UPDATE A CONFIG FILE
|
|
#=================================================
|
|
ynh_script_progression "Updating configuration..."
|
|
|
|
ynh_config_add --template="default.env" --destination="$install_dir/.env"
|
|
|
|
#=================================================
|
|
# UPGRADE DATABASE
|
|
#=================================================
|
|
ynh_script_progression "Upgrading the database..."
|
|
|
|
pushd "$install_dir"
|
|
# Clear caches
|
|
# https://github.com/invoiceninja/invoiceninja/issues/7397
|
|
#ynh_safe_rm $install_dir/bootstrap/cache/
|
|
#ynh_safe_rm $install_dir/storage/framework/cache/
|
|
#ynh_safe_rm $install_dir/storage/framework/sessions/
|
|
|
|
#mkdir -p $install_dir/bootstrap/cache/ $install_dir/storage/framework/cache/ $install_dir/storage/framework/sessions/
|
|
|
|
# clear cached stuff under /app/data/storage/framework (https://github.com/laravel/framework/issues/17377)
|
|
php$php_version artisan view:clear
|
|
php$php_version artisan cache:clear
|
|
|
|
# Run the database migrations
|
|
php$php_version artisan migrate --force --no-interaction --verbose
|
|
|
|
# Optimize the framework for better performance
|
|
php$php_version artisan optimize --no-interaction --verbose
|
|
|
|
# clear cached stuff under /app/data/storage/framework (https://github.com/laravel/framework/issues/17377)
|
|
#php$php_version artisan view:clear
|
|
#php$php_version artisan cache:clear
|
|
popd
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression "Upgrade of $app completed"
|