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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
<?php
class StEP00278GlobalSearch extends Migration
{
function description() {
return 'Adds global search module management to config';
}
function up() {
$modules = [
'GlobalSearchBuzzwords' => [
'order' => 1,
'active' => true,
'fulltext' => false
],
'GlobalSearchMyCourses' => [
'order' => 2,
'active' => true,
'fulltext' => false
],
'GlobalSearchCourses' => [
'order' => 3,
'active' => true,
'fulltext' => false
],
'GlobalSearchUsers' => [
'order' => 4,
'active' => true,
'fulltext' => false
],
'GlobalSearchInstitutes' => [
'order' => 5,
'active' => true,
'fulltext' => false
],
'GlobalSearchFiles' => [
'order' => 6,
'active' => true,
'fulltext' => false
],
'GlobalSearchCalendar' => [
'order' => 7,
'active' => true,
'fulltext' => false
],
'GlobalSearchMessages' => [
'order' => 8,
'active' => true,
'fulltext' => false
],
'GlobalSearchForum' => [
'order' => 9,
'active' => true,
'fulltext' => false
],
'GlobalSearchResources' => [
'order' => 10,
'active' => true,
'fulltext' => false
],
'GlobalSearchRoomAssignments' => [
'order' => 11,
'active' => true,
'fulltext' => false
],
'GlobalSearchModules' => [
'order' => 12,
'active' => true,
'fulltext' => false
]
];
$stmt = DBManager::get()->prepare("INSERT INTO `config`
(`field`, `value`, `type`, `range`, `section`, `mkdate`, `chdate`, `description`)
VALUES
(:name, :value, :type, 'global', 'globalsearch', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :desc)
ON DUPLICATE KEY UPDATE `chdate`=VALUES(`chdate`)");
$stmt->execute([
'name' => 'GLOBALSEARCH_MODULES',
'value' => json_encode($modules),
'type' => 'array',
'desc' => 'Aktivierung und Reihenfolge der Module in der globalen Suche'
]);
$stmt->execute([
'name' => 'GLOBALSEARCH_MAX_RESULT_OF_TYPE',
'value' => 3,
'type' => 'integer',
'desc' => 'Wie viele Ergebnisse sollen in der globalen Schnellsuche pro Kategorie angezeigt werden?'
]);
$stmt->execute([
'name' => 'GLOBALSEARCH_ASYNC_QUERIES',
'value' => true,
'type' => 'boolean',
'desc' => 'Sollen die Suchanfragen asynchron über mysqli gestellt werden? Andernfalls wird PDO verwendet.'
]);
DBManager::get()->exec("CREATE TABLE IF NOT EXISTS `globalsearch_buzzwords` (
`id` VARCHAR(32) NOT NULL,
`rights` ENUM('user','autor','tutor','dozent','admin','root') NOT NULL DEFAULT 'user',
`name` varchar(255) NOT NULL DEFAULT '',
`buzzwords` varchar(2048) NOT NULL DEFAULT '',
`subtitle` varchar(255) DEFAULT NULL,
`url` varchar(2048) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC");
}
function down() {
DBManager::get()->exec("DELETE FROM `config` WHERE `field` IN (
'GLOBALSEARCH_MODULES',
'GLOBALSEARCH_MAX_RESULT_OF_TYPE',
'GLOBALSEARCH_ASYNC_QUERIES')"
);
DBManager::get()->exec("DROP TABLE IF EXISTS `globalsearch_buzzwords`");
}
}
|