This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.php
92 lines (68 loc) · 2.49 KB
/
install.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
// clangs
$clangs = rex_clang::getAll();
// all tables
$bloggerEntriesTable = rex::getTable('blogger_entries');
$bloggerContentTable = rex::getTable('blogger_content');
$bloggerCategoriesTable = rex::getTable('blogger_categories');
$bloggerTagsTable = rex::getTable('blogger_tags');
// ensure tables
$table = rex_sql_table::get($bloggerEntriesTable);
$table->ensurePrimaryIdColumn();
$table->ensureColumn(new rex_sql_column('category', 'int(11)', false, 1));
$table->ensureColumn(new rex_sql_column('tags', 'text', false, ''));
$table->ensureColumn(new rex_sql_column('status', 'int(11)', false, 0));
$table->ensureColumn(new rex_sql_column('postedBy', 'varchar(255)', false, ''));
$table->ensureColumn(new rex_sql_column('postedAt', 'datetime'));
$table->ensure();
$table = rex_sql_table::get($bloggerContentTable);
$table->ensurePrimaryIdColumn();
$table->ensureColumn(new rex_sql_column('pid', 'int(10) unsigned'));
$table->ensureColumn(new rex_sql_column('clang', 'int(11)', false, 1));
$table->ensureColumn(new rex_sql_column('title', 'varchar(255)', false, ''));
$table->ensureColumn(new rex_sql_column('text', 'text', false, ''));
$table->ensureColumn(new rex_sql_column('preview', 'varchar(1024)', false, ''));
$table->ensureColumn(new rex_sql_column('gallery', 'text', false, ''));
$table->ensure();
$table = rex_sql_table::get($bloggerCategoriesTable);
$table->ensurePrimaryIdColumn();
foreach ($clangs as $clang) {
$name = 'name_' . $clang->getId();
$table->ensureColumn(new rex_sql_column($name, 'varchar(256)', false, ''));
}
$table->ensure();
$table = rex_sql_table::get($bloggerTagsTable);
$table->ensurePrimaryIdColumn();
foreach ($clangs as $clang) {
$name = 'tag_' . $clang->getId();
$table->ensureColumn(new rex_sql_column($name, 'varchar(256)', false, ''));
}
$table->ensure();
// default categories
$sql = rex_sql::factory();
$sql->setTable($bloggerCategoriesTable);
$sql->select();
if ($sql->getRows() <= 0) {
$sql = rex_sql::factory();
$sql->setTable($bloggerCategoriesTable);
$sql->setValue('id', 1);
foreach ($clangs as $clang) {
$name = 'name_' . $clang->getId();
$sql->setValue($name, 'Default');
}
$sql->insert();
}
// default tag
$sql = rex_sql::factory();
$sql->setTable($bloggerTagsTable);
$sql->select();
if ($sql->getRows() <= 0) {
$sql = rex_sql::factory();
$sql->setTable($bloggerTagsTable);
$sql->setValue('id', 1);
foreach ($clangs as $clang) {
$name = 'tag_' . $clang->getId();
$sql->setValue($name, 'Default');
}
$sql->insert();
}