Less home code more F3

This commit is contained in:
julien
2026-03-30 00:00:03 +02:00
parent d71cf304a9
commit fac7f60190
30 changed files with 818 additions and 1552 deletions

View File

@@ -3,6 +3,7 @@
declare(strict_types=1);
$f3 = require __DIR__ . '/bootstrap.php';
User::bootstrap($f3->get('DB'));
$username = trim((string) ($argv[1] ?? ''));
if ($username === '') {
@@ -20,17 +21,10 @@ if (stripos(PHP_OS, 'WIN') !== 0) {
}
fwrite(STDOUT, PHP_EOL);
if ($password === '') {
fwrite(STDERR, "Mot de passe vide.\n");
exit(1);
}
User::bootstrap($f3->get('DB'));
try {
$id = (new User())->create($username, $password);
fwrite(STDOUT, "Admin créé (ID {$id}).\n");
} catch (RuntimeException $e) {
fwrite(STDERR, $e->getMessage() . "\n");
fwrite(STDERR, $e->getMessage() . PHP_EOL);
exit(1);
}

View File

@@ -6,7 +6,7 @@ $f3 = require __DIR__ . '/bootstrap.php';
$db = $f3->get('DB');
User::bootstrap($db);
Post::bootstrap($db);
Media::bootstrap($db);
Post::bootstrap($db);
fwrite(STDOUT, 'Base initialisée : ' . Base::instance()->get('paths.db') . "\n");
fwrite(STDOUT, 'Base initialisée : ' . $f3->get('paths.db') . PHP_EOL);