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

36 lines
977 B
PHP
Raw Normal View History

<?php
2019-05-11 00:27:31 +02:00
// 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
2023-10-02 19:22:17 +02:00
//$root_path = "__INSTALL_DIR__";
$root_path = $_SERVER["argv"][1];
if (empty($root_path) || !is_dir($root_path)) {
fwrite(STDERR, "Chemin manquant dans hook : post_app_upgrade");
exit(1);
}
require $root_path."/bootstrap.php";
$storageType = $config->get("storage", "type", "files");
if ($storageType == "db") {
$userStorage = new \App\Storage\Db\User($dbConnection);
} else {
$userStorage = new \App\Storage\File\User(DOCUMENT_ROOT."/var/users.db");
}
$_POST = array(
"upgrade" => 1,
);
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.
2019-05-11 00:27:31 +02:00
if (!empty($errors)) {
fwrite(STDERR, str_replace(
array("<br>", "<br />"), "", implode("\n", $errors)
));
exit(1);
}