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/upgrade_cheky.php
Gofannon 5af9dc26f5 WIP - rework automated upgrade method
Does not work at the moment.
2019-05-08 14:42:53 +02:00

37 lines
941 B
PHP

<?php
// source: https://forum.cheky.net/mise-a-jour-de-cheky-en-ligne-de-commande-t659-p1.html#p2624
//$root_path = "__FINALPATH__";
$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");
}
//require $root_path."/bootstrap.php";
$_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.
#if (!empty($errors)) {
# fwrite(STDERR, str_replace(
# array("<br>", "<br />"), "", implode("\n", $errors)
# );
# exit(1);
#}