mirror of
https://github.com/YunoHost-Apps/framaforms_ynh.git
synced 2024-09-03 18:36:12 +02:00
[fix] Db installation
This commit is contained in:
parent
15af67bc21
commit
a0d4407fdb
4 changed files with 57 additions and 26 deletions
|
@ -51,6 +51,16 @@
|
||||||
},
|
},
|
||||||
"example": "Choose a password"
|
"example": "Choose a password"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "language",
|
||||||
|
"type": "string",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose the application language",
|
||||||
|
"fr": "Choisissez la langue de l'application"
|
||||||
|
},
|
||||||
|
"choices": ["fr", "en"],
|
||||||
|
"default": "en"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"ask": {
|
"ask": {
|
||||||
|
|
|
@ -56,6 +56,12 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
|
#=================================================
|
||||||
|
# BACKUP A CRON FILE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE POSTGRESQL DATABASE
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -26,6 +26,7 @@ domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
password=$YNH_APP_ARG_PASSWORD
|
||||||
|
language=$YNH_APP_ARG_LANGUAGE
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
ynh_app_setting_set --app=$app --key=password --value=$password
|
ynh_app_setting_set --app=$app --key=password --value=$password
|
||||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||||
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -134,14 +136,6 @@ ynh_install_composer --phpversion="$phpversion" --workdir="$final_path/.composer
|
||||||
|
|
||||||
export PATH="$final_path/.composer/vendor/bin:$PATH"
|
export PATH="$final_path/.composer/vendor/bin:$PATH"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INITIALIZE POSTGRESQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Initializing PostgreSQL database..." --weight=8
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="betaforms" --replace_string="$db_user" --target_file="$final_path/framaforms.sql"
|
|
||||||
ynh_psql_execute_file_as_root --file="$final_path/framaforms.sql" --database="$db_name"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INITIALIZE TMP AND PRIVATE DIRECTORY
|
# INITIALIZE TMP AND PRIVATE DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -182,30 +176,31 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHANGE ADMIN PASSWORD AND APPLY CUSTOM CONF
|
# CHANGE ADMIN PASSWORD AND APPLY CUSTOM CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Changing admin password..." --weight=19
|
ynh_script_progression --message="Installing database..." --weight=19
|
||||||
|
|
||||||
chown -R $app: $final_path
|
chown -R $app: $final_path
|
||||||
|
|
||||||
update-alternatives --set php /usr/bin/php7.3
|
update-alternatives --set php /usr/bin/php$phpversion
|
||||||
|
ynh_exec_as $app env PATH=$PATH drush @$app site-install framaforms_org install_configure_form.site_contact_url="https://forum.yunohost.org/t/framaforms-create-polls-using-drag-and-drop/8208" install_configure_form.site_default_country=FR -y --locale="$language" --account-name="admin" --account-pass="$password" --site-name="Framaforms" --site-mail="no-reply@$domain" 2>&1
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app user-password "admin" --password="$password" 2>&1
|
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app variable-set site_name "Framaforms" 2>&1
|
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app variable-set site_mail "no-reply@$domain" 2>&1
|
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app variable-set file_private_path "/home/yunohost.app/$app/data" 2>&1
|
ynh_exec_as $app env PATH=$PATH drush @$app variable-set file_private_path "/home/yunohost.app/$app/data" 2>&1
|
||||||
|
ynh_exec_as $app env PATH=$PATH drush @$app pm-enable framaforms_feature -y --resolve-dependencies 2>&1
|
||||||
|
ynh_exec_as $app env PATH=$PATH drush @$app php-eval "module_load_include('inc', 'framaforms', 'includes/framaforms.pages');create_all_pages();" 2>&1 || true
|
||||||
|
sudo -u $app env PATH=$PATH drush @$app pm-download -y drush_language
|
||||||
|
#sudo -u $app env PATH=$PATH drush @$app pm-download ldap
|
||||||
|
#sudo -u $app env PATH=$PATH drush @$app pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role
|
||||||
|
sudo -u $app env PATH=$PATH drush @$app pm-download -y l10n_update
|
||||||
|
sudo -u $app env PATH=$PATH drush @$app pm-enable -y l10n_update
|
||||||
|
sudo -u $app env PATH=$PATH drush @$app language-add $language -y
|
||||||
|
sudo -u $app env PATH=$PATH drush @$app language-default $language -y
|
||||||
|
sudo -u $app env PATH=$PATH drush @$app cache-clear drush -y
|
||||||
|
sudo -u $app env PATH=$PATH drush @$app l10n-update-refresh -y
|
||||||
|
sudo -u $app env PATH=$PATH drush @$app l10n-update -y
|
||||||
|
sudo -u $app env PATH=$PATH drush @$app pm-update -y || true
|
||||||
|
sudo -u $app env PATH=$PATH drush @$app core-cron -y || true
|
||||||
# Remove some Framasoft branding
|
# Remove some Framasoft branding
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app sql-query "UPDATE block_custom SET body='' WHERE bid=12" 2>&1
|
#ynh_exec_as $app env PATH=$PATH drush @$app sql-query "UPDATE block_custom SET body='' WHERE bid=12" 2>&1
|
||||||
|
|
||||||
# Fix some link if install on subpath
|
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app sql-query "UPDATE block_custom SET body=REPLACE(body, 'href=\"/', 'href=\"')" 2>&1
|
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app sql-query "UPDATE field_data_body SET body_value=REPLACE(body_value, 'src=\"/', 'src=\"')" 2>&1
|
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app sql-query "UPDATE field_data_body SET body_value=REPLACE(body_value, 'href=\"/', 'href=\"')" 2>&1
|
|
||||||
ynh_exec_as $app env PATH=$PATH drush @$app cache-clear all 2>&1
|
|
||||||
#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
|
||||||
|
@ -215,6 +210,16 @@ ynh_script_progression --message="Storing the config file checksum..." --weight=
|
||||||
# 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"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP THE CRON FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setuping the cron file..."
|
||||||
|
|
||||||
|
cp ../conf/cron /etc/cron.d/$app
|
||||||
|
|
||||||
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app"
|
||||||
|
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -63,6 +63,16 @@ ynh_script_progression --message="Removing php-fpm configuration..." --weight=1
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated php-fpm config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC REMOVE
|
||||||
|
#=================================================
|
||||||
|
# REMOVE THE CRON FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing the cron file..."
|
||||||
|
|
||||||
|
# Remove a cron file
|
||||||
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue