-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.php
75 lines (63 loc) · 1.41 KB
/
setup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
namespace Icybee;
/* @var $app \ICanBoogie\Application */
use ICanBoogie\ErrorCollection;
use Icybee\Modules\Pages\Page;
use Icybee\Modules\Sites\Site;
use Icybee\Modules\Users\User;
$app = require_once __DIR__ . '/bootstrap.php';
$language = "en";
set_exception_handler(function ($e) {
echo $e;
});
$app->modules->install($errors = new ErrorCollection);
if (!$app->models['users']->exists(1))
{
User::from([
User::USERNAME => "geralt",
User::EMAIL => "[email protected]",
User::PASSWORD => 'yennifer',
])->save();
}
if (!$app->models['sites']->exists(1))
{
Site::from([
Site::EMAIL => "[email protected]",
Site::TIMEZONE => "UTC",
Site::LANGUAGE => $language,
Site::TITLE => "Kaer Morhen",
Site::STATUS => Site::STATUS_OK,
])->save();
}
$app->models['nodes']->truncate();
$app->models['pages']->truncate();
if (!$app->models['pages']->exists(1))
{
// home
Page::from([
Page::TITLE => "Kaer Morhen",
Page::IS_ONLINE => true,
Page::UID => 1,
Page::SITE_ID => 1,
Page::LANGUAGE => $language,
Page::WEIGHT => 0
])->save();
// page
Page::from([
Page::TITLE => "Novigrad",
Page::IS_ONLINE => true,
Page::UID => 1,
Page::SITE_ID => 1,
Page::LANGUAGE => $language,
Page::WEIGHT => 1
])->save();
// page
Page::from([
Page::TITLE => "Oxenfurt",
Page::IS_ONLINE => true,
Page::UID => 1,
Page::SITE_ID => 1,
Page::LANGUAGE => $language,
Page::WEIGHT => 2
])->save();
}