diff --git a/scripts/upgrade b/scripts/upgrade index 787aebf..92642dd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -124,18 +124,9 @@ ynh_print_info "Running specific upgrade..." # Give full access to "$app" so php script can do "its own magic stuff" chown -R $app: $final_path -#exec_as "$app" "/usr/bin/php $YNH_CWD/upgrade_cheky.php $final_path" -sudo -u "$app" "/usr/bin/php $YNH_CWD/upgrade_cheky.php $final_path" - -#================================================= -# CONFIGURE HOOKS -#================================================= -### TODO: Better to use a hook like "post_app_upgrade" ? -#ynh_print_info "Running post upgrade recipe..." - -#ynh_replace_string "__FINALPATH__" "$final_path" "../hooks/post_app_install" -#ynh_replace_string "__FINALPATH__" "$final_path" "../hooks/post_app_remove" - +# Copy Yunohost custom script to cheky folder and launch it +cp yunohost_upgrade_cheky.php $final_path/others/update/ +exec_as "$app" /usr/bin/php $final_path/others/update/yunohost_upgrade_cheky.php $final_path #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade_cheky.php b/scripts/yunohost_upgrade_cheky.php similarity index 77% rename from scripts/upgrade_cheky.php rename to scripts/yunohost_upgrade_cheky.php index 645af4d..99b1eed 100644 --- a/scripts/upgrade_cheky.php +++ b/scripts/yunohost_upgrade_cheky.php @@ -1,5 +1,5 @@ 1, ); @@ -29,9 +27,9 @@ require $root_path."/app/admin/scripts/upgrade.php"; // S'il y a des erreurs, on les écrit dans STDERR et on quitte // avec un code erreur. -#if (!empty($errors)) { -# fwrite(STDERR, str_replace( -# array("
", "
"), "", implode("\n", $errors) -# ); -# exit(1); -#} +if (!empty($errors)) { + fwrite(STDERR, str_replace( + array("
", "
"), "", implode("\n", $errors) + )); + exit(1); +}