1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/framaforms_ynh.git synced 2024-09-03 18:36:12 +02:00

Cleanup + fix drush

This commit is contained in:
yalh76 2019-08-05 03:02:23 +02:00 committed by ljf (zamentur)
parent b8eadf0396
commit 67fe8be48d
2 changed files with 26 additions and 39 deletions

View file

@ -73,10 +73,6 @@ ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=9 ynh_script_progression --message="Setting up source files..." --weight=9
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
### downloaded from an upstream source, like a git repository.
### `ynh_setup_source` use the file conf/app.src
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
@ -85,8 +81,6 @@ ynh_setup_source --dest_dir="$final_path"
#================================================= #=================================================
ynh_script_progression --message="Configuring nginx web server..." --weight=1 ynh_script_progression --message="Configuring nginx web server..." --weight=1
### `ynh_add_nginx_config` will use the file conf/nginx.conf
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -96,7 +90,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Configuring system user..." --weight=3 ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user # Create a system user
ynh_system_user_create --username=$app ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# INSTALL PHP 7.2 # INSTALL PHP 7.2
@ -140,6 +134,8 @@ cp -f "../conf/composer.json" "$final_path/.composer/composer.json"
ynh_install_composer --phpversion="7.2" --workdir="$final_path/.composer" ynh_install_composer --phpversion="7.2" --workdir="$final_path/.composer"
export PATH="$final_path/.composer/vendor/bin:$PATH"
#================================================= #=================================================
# Database initialization # Database initialization
#================================================= #=================================================
@ -190,27 +186,23 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path"
ynh_script_progression --message="Changing admin password..." --weight=19 ynh_script_progression --message="Changing admin password..." --weight=19
chown -R $app: $final_path chown -R $app: $final_path
drush="$final_path/.composer/vendor/bin/drush --quiet"
pushd $final_path
ynh_exec_as $app $drush upwd --password="$password" "admin" --verbose --debug
ynh_exec_as $app $drush variable-set site_name "Framaforms" --verbose --debug
ynh_exec_as $app $drush variable-set site_mail "no-reply@$domain" --verbose --debug
ynh_exec_as $app $drush variable-set file_private_path "/home/yunohost.app/$app/data" --verbose --debug
#ynh_exec_as $app $drush @$app pm-download ldap
#ynh_exec_as $app $drush @$app pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role
#ynh_exec_as $app $drush @$app core-cron
popd
#================================================= update-alternatives --set php /usr/bin/php7.2
ynh_exec_as $app env PATH=$PATH drush @$app upwd --password="$password" "admin" --verbose --debug
ynh_exec_as $app env PATH=$PATH drush @$app variable-set site_name "Framaforms" --verbose --debug
ynh_exec_as $app env PATH=$PATH drush @$app variable-set site_mail "no-reply@$domain" --verbose --debug
ynh_exec_as $app env PATH=$PATH drush @$app variable-set file_private_path "/home/yunohost.app/$app/data" --verbose --debug
#ynh_exec_as $app env PATH=$PATH drush @$app pm-download ldap
#ynh_exec_as $app env PATH=$PATH drush @$app pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role
#ynh_exec_as $app env PATH=$PATH drush @$app core-cron
update-alternatives --set php /usr/bin/php7.0
#================================================= #=================================================
# STORE THE CONFIG FILE CHECKSUM # STORE THE CONFIG FILE CHECKSUM
#================================================= #=================================================
### `ynh_store_file_checksum` is used to store the checksum of a file.
### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`,
### you can make a backup of this file before modifying it again if the admin had modified it.
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config_file" ynh_store_file_checksum --file="$config_file"

View file

@ -30,12 +30,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
### This helper will compare the version of the currently installed app and the version of the upstream package.
### $upgrade_type can have 2 different values
### - UPGRADE_APP if the upstream app version has changed
### - UPGRADE_PACKAGE if only the YunoHost package has changed
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
@ -113,7 +107,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# UPGRADE PHP # UPGRADE PHP
@ -146,17 +140,17 @@ ynh_script_progression --message="Upgrading Drupal..." --time --weight=30
ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php" ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php"
drush="$final_path/.composer/vendor/bin/drush --quiet" export PATH="$final_path/.composer/vendor/bin:$PATH"
pushd $final_path
ynh_exec_as $app $drush
ynh_exec_as $app $drush variable-set --exact maintenance_mode 1
ynh_exec_as $app $drush cache-clear all
ynh_exec_as $app $drush pm-update -y drupal
ynh_exec_as $app $drush vset --exact maintenance_mode 0
ynh_exec_as $app $drush cache-clear all
popd
#================================================= update-alternatives --set php /usr/bin/php7.2
ynh_exec_as $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all
ynh_exec_as $app env PATH=$PATH drush @$app pm-update -y drupal
ynh_exec_as $app env PATH=$PATH drush @$app vset --exact maintenance_mode 0
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all
update-alternatives --set php /usr/bin/php7.0
#================================================= #=================================================
# STORE THE CONFIG FILE CHECKSUM # STORE THE CONFIG FILE CHECKSUM
@ -168,6 +162,7 @@ ynh_store_file_checksum --file="$config_file"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================