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

Upgrade to yakforms

This commit is contained in:
ljf 2022-12-09 18:47:56 +01:00
parent 44bcce90b1
commit a7601be731
No known key found for this signature in database
2 changed files with 61 additions and 20 deletions

View file

@ -6,12 +6,12 @@
"en": "Create online webforms and surveys", "en": "Create online webforms and surveys",
"fr": "Créez des formulaires et questionnaires en ligne" "fr": "Créez des formulaires et questionnaires en ligne"
}, },
"version": "1.0.3~ynh3", "version": "1.1~ynh1",
"url": "https://framaforms.org", "url": "https://yakforms.org",
"upstream": { "upstream": {
"license": "GPL-2.0-only", "license": "GPL-2.0-only",
"website": "https://framaforms.org", "website": "https://yakforms.org",
"code": "https://framagit.org/framasoft/framaforms" "code": "https://framagit.org/yakforms/yakforms"
}, },
"license": "GPL-2.0-only", "license": "GPL-2.0-only",
"maintainer": { "maintainer": {

View file

@ -90,21 +90,6 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=9
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path/app"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
@ -141,6 +126,45 @@ chmod 750 "$datadir"
chmod -R o-rwx "$datadir" chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir" chown -R $app:www-data "$datadir"
#=================================================
# Framaforms 2 Yakforms Backup
#=================================================
upgrade_to_yakforms=false
if test -d "$final_path/app/CHANGELOG-FRAMAFORMS.md"
then
update-alternatives --set php /usr/bin/php$phpversion
upgrade_to_yakforms=true
pushd "$final_path"
ynh_exec_as $app env PATH=$PATH php framaforms2yakforms.php backup
ynh_exec_as $app env PATH=$PATH drush @$app dis framaforms
ynh_exec_as $app env PATH=$PATH drush @$app pm-uninstall framaforms
ynh_exec_as $app env PATH=$PATH drush @$app dis framaforms_share_results
ynh_exec_as $app env PATH=$PATH drush @$app pm-uninstall framaforms_share_results
ynh_exec_as $app env PATH=$PATH drush @$app dis framaforms_public_results
ynh_exec_as $app env PATH=$PATH drush @$app pm-uninstall framaforms_public_results
ynh_exec_as $app env PATH=$PATH drush @$app dis framaforms_spam
ynh_exec_as $app env PATH=$PATH drush @$app pm-uninstall framaforms_spam
popd
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=9
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path/app"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# UPGRADE COMPOSER # UPGRADE COMPOSER
#================================================= #=================================================
@ -150,10 +174,27 @@ 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"
#=================================================
# Framaforms 2 Yakforms Restore
#=================================================
if [ "$upgrade_to_yakforms" = true ]
then
update-alternatives --set php /usr/bin/php$phpversion
pushd "$final_path"
ynh_exec_as $app env PATH=$PATH drush @$app en yakforms
ynh_exec_as $app env PATH=$PATH drush @$app dis yakforms_share_results
ynh_exec_as $app env PATH=$PATH drush @$app dis yakforms_public_results
ynh_exec_as $app env PATH=$PATH drush @$app dis yakforms_spam
ynh_exec_as $app env PATH=$PATH php framaforms2yakforms.php restore
ynh_exec_as $app env PATH=$PATH php framaforms2yakforms.php clean
popd
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
fi
#================================================= #=================================================
# UPGRADE DRUPAL # UPGRADE DRUPAL
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading Drupal..." --weight=30 ynh_script_progression --message="Upgrading Drupal..." --weight=30