<?php

declare(strict_types=1);

if (PHP_SAPI !== 'cli') {
    http_response_code(404);
    exit(1);
}
$root = dirname(__DIR__);
require_once $root . '/app/Services/DB.php';
require_once $root . '/app/Services/Migrations.php';
require_once $root . '/app/Services/I18n.php';
require_once $root . '/app/Services/AppSettings.php';
require_once $root . '/app/Services/BackupService.php';
Migrations::run($root . '/migrations');
I18n::setLocale(AppSettings::get('app_language'));
$backup = BackupService::create($argv[1] ?? 'cli');
fwrite(STDOUT, $backup['name'] . PHP_EOL);
