From 6cb2b42edbd524188b5ae16ff33c3a049fbbfcb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Pleva=C4=8D?= Date: Sun, 1 Oct 2023 11:03:36 +0200 Subject: [PATCH] Added support for seeds detect --- web/DAL/system.php | 14 ++++++++++++++ web/index.php | 13 ++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 web/DAL/system.php diff --git a/web/DAL/system.php b/web/DAL/system.php new file mode 100644 index 0000000..0506269 --- /dev/null +++ b/web/DAL/system.php @@ -0,0 +1,14 @@ +name = new \wsos\database\types\text($name); + $this->value = new \wsos\database\types\text($value); + } + } +?> \ No newline at end of file diff --git a/web/index.php b/web/index.php index 98641cd..9eaddfa 100644 --- a/web/index.php +++ b/web/index.php @@ -49,9 +49,16 @@ $container->register("auth", $auth); $container->register("router", $router); - // seeds DB - // do not do this in release!! - //include "seeds.php"; + $system = new \DAL\system(); + + // detect if is seeded + if (!$system->find("name", "seeds")) { + include "seeds.php"; + + $system->name = "seeds"; + $system->value = "true"; + $system->commit(); + } $router->route($url); ?> \ No newline at end of file