ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilFileServicesDatabaseObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
26 protected ?ilDBInterface $database = null;
27
28 public function prepare(ilDBInterface $db): void
29 {
30 $this->database = $db;
31 }
32
36 public function step_1(): void
37 {
38 $this->abortIfNotPrepared();
39
40 if ($this->database->tableExists("il_upload_policy")) {
41 return;
42 }
43
44 $this->database->createTable("il_upload_policy", [
45 "policy_id" => [
46 'type' => 'integer',
47 'length' => 8,
48 'notnull' => true,
49 ],
50 "title" => [
51 'type' => 'text',
52 'length' => 256,
53 'notnull' => true,
54 ],
55 "upload_limit_in_mb" => [
56 'type' => 'integer',
57 'length' => 8,
58 'notnull' => true,
59 ],
60 "audience" => [
61 'type' => 'text',
62 'length' => 512,
63 'notnull' => true,
64 ],
65 "audience_type" => [
66 'type' => 'integer',
67 'length' => 2,
68 'notnull' => true,
69 ],
70 "scope_definition" => [
71 'type' => 'text',
72 'length' => 512,
73 'notnull' => true,
74 ],
75 "active" => [
76 'type' => 'integer',
77 'length' => 1,
78 'notnull' => true,
79 ],
80 "valid_from" => [
81 'type' => 'date',
82 'notnull' => false,
83 ],
84 "valid_until" => [
85 'type' => 'date',
86 'notnull' => false,
87 ],
88 "owner" => [
89 'type' => 'integer',
90 'length' => 8,
91 'notnull' => true,
92 ],
93 "create_date" => [
94 'type' => 'timestamp',
95 'notnull' => true,
96 ],
97 "last_update" => [
98 'type' => 'timestamp',
99 'notnull' => true,
100 ]
101 ]);
102
103 $this->database->createSequence("il_upload_policy");
104 }
105
110 protected function abortIfNotPrepared(): void
111 {
112 if (null === $this->database) {
113 throw new LogicException(self::class . "::prepare() must be called before db-update-steps execution.");
114 }
115 }
116}
step_1()
adds a new table to store data of file upload policies
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...