Added support for seeds detect

This commit is contained in:
Lukáš Plevač 2023-10-01 11:03:36 +02:00
parent e51e7babe6
commit 6cb2b42edb
2 changed files with 24 additions and 3 deletions

14
web/DAL/system.php Normal file
View File

@ -0,0 +1,14 @@
<?php
namespace DAL;
class station extends \wsos\database\core\row {
public \wsos\database\types\text $name;
public \wsos\database\types\text $value;
function __construct($id = null, $name = "", $value = "") {
parent::__construct($id);
$this->name = new \wsos\database\types\text($name);
$this->value = new \wsos\database\types\text($value);
}
}
?>

View File

@ -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);
?>