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

fix automated upgrade

This commit is contained in:
Gofannon 2019-05-11 00:27:31 +02:00
parent 5af9dc26f5
commit c368ad4bfe
2 changed files with 10 additions and 21 deletions

View file

@ -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

View file

@ -1,5 +1,5 @@
<?php
// Script d'upgrade custom pour automatiser la MAJ sans action de l'utilisateur
// source: https://forum.cheky.net/mise-a-jour-de-cheky-en-ligne-de-commande-t659-p1.html#p2624
//$root_path = "__FINALPATH__";
@ -19,8 +19,6 @@ if ($storageType == "db") {
$userStorage = new \App\Storage\File\User(DOCUMENT_ROOT."/var/users.db");
}
//require $root_path."/bootstrap.php";
$_POST = array(
"upgrade" => 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("<br>", "<br />"), "", implode("\n", $errors)
# );
# exit(1);
#}
if (!empty($errors)) {
fwrite(STDERR, str_replace(
array("<br>", "<br />"), "", implode("\n", $errors)
));
exit(1);
}