<?php

if (core::ifGet("from")) {
    backup::create();
    file::cleanFilesByOrder(DIR_BACKUP, BACKUP_LIMIT);

    historique::recRef("/parametres.html");
    historique::add(array(
        "idType" => historique::getIdRef("ACTION"),
        "idUser" => session::getId(),
        "idPage" => historique::getIdRef("/parametres.html"),
        "log" => "Création d'un backup"
    ));

    header("Location: /parametres.html#parametres-restore");
    exit();
} else {
    header('HTTP/1.0 401 Unauthorized');
    exit();
}
