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
|
<?php
class ShowAdressees extends Migration
{
private $options = [
[
'name' => 'SHOW_ADRESSEES_LIMIT',
'description' => 'Ab wievielen Adressaten dürfen diese aus datenschutzgründen nicht mehr angezeigt werden in einer empfangenen Nachricht?',
'section' => 'global',
'range' => 'global',
'type' => 'integer',
'value' => '20'
]
];
public function description()
{
return 'Lets Stud.IP display the adressees of a Stud.IP-message.';
}
public function up()
{
foreach ($this->options as $option) {
DBManager::get()->execute("INSERT IGNORE INTO `config` (`field`, `value`, `type`, `range`, `section`, `mkdate`, `chdate`, `description`) VALUES (:name, :value, :type, :range, :section, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)",
$option);
}
DBManager::get()->exec("
ALTER TABLE message
ADD COLUMN `show_adressees` tinyint(4) NOT NULL DEFAULT '0' AFTER `message`
");
}
public function down()
{
$db = DBManager::get();
$stmt = $db->prepare("DELETE FROM config WHERE field = :name");
foreach ($this->options as $option) {
$stmt->execute(['name' => $option['name']]);
}
DBManager::get()->exec("
ALTER TABLE message
DROP COLUMN `show_adressees`
");
}
}
|