ILIAS  release_8 Revision v8.23
ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps Class Reference
+ Inheritance diagram for ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps:
+ Collaboration diagram for ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps:

Public Member Functions

 prepare (\ilDBInterface $db)
 Prepare the execution of the steps. More...
 
 step_1 ()
 
 step_2 ()
 
 step_3 ()
 
 step_4 ()
 
 step_5 ()
 
 step_6 ()
 

Protected Attributes

ilDBInterface $db
 

Private Member Functions

 useTransaction (callable $updateStep)
 

Detailed Description

Author
Nicolas Schaefli nick@.nosp@m.flux.nosp@m.labs..nosp@m.ch

Definition at line 32 of file class.ilEmployeeTalkDBUpdateSteps.php.

Member Function Documentation

◆ prepare()

ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps::prepare ( \ilDBInterface  $db)

Prepare the execution of the steps.

Do not use anything from the globals or the DIC inside your steps, only use the instance of the database provided here.

Implements ilDatabaseUpdateSteps.

Definition at line 36 of file class.ilEmployeeTalkDBUpdateSteps.php.

References ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps\$db.

36  : void
37  {
38  $this->db = $db;
39  }

◆ step_1()

ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps::step_1 ( )

Definition at line 60 of file class.ilEmployeeTalkDBUpdateSteps.php.

60  : void
61  {
62  // removed this content in favour of a ilTreeAdminNodeAddedObjective
63  }

◆ step_2()

ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps::step_2 ( )

Definition at line 65 of file class.ilEmployeeTalkDBUpdateSteps.php.

References ilDBInterface\addIndex(), ilDBInterface\addPrimaryKey(), ilDBInterface\createTable(), ilDBInterface\tableExists(), and ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps\useTransaction().

65  : void
66  {
67  $this->useTransaction(function (\ilDBInterface $db) {
68  $etalTableName = 'etal_data';
69 
70  if (!$db->tableExists($etalTableName)) {
71  $db->createTable($etalTableName, [
72  'object_id' => ['type' => 'integer', 'length' => 8, 'notnull' => true],
73  'series_id' => ['type' => 'text', 'length' => 36, 'notnull' => true, 'fixed' => true],
74  'start_date' => ['type' => 'integer', 'length' => 8, 'notnull' => true],
75  'end_date' => ['type' => 'integer', 'length' => 8, 'notnull' => true],
76  'all_day' => ['type' => 'integer', 'length' => 1, 'notnull' => true],
77  'employee' => ['type' => 'integer', 'length' => 8, 'notnull' => true],
78  'location' => ['type' => 'text', 'length' => 200, 'notnull' => false, 'fixed' => false],
79  'completed' => ['type' => 'integer', 'length' => 1, 'notnull' => true]
80  ]);
81 
82  $db->addPrimaryKey($etalTableName, ['object_id']);
83  $db->addIndex($etalTableName, ['series_id'], 'ser');
84  $db->addIndex($etalTableName, ['employee'], 'emp');
85  }
86  });
87  }
tableExists(string $table_name)
addIndex(string $table_name, array $fields, string $index_name='', bool $fulltext=false)
addPrimaryKey(string $table_name, array $primary_keys)
createTable(string $table_name, array $fields, bool $drop_table=false, bool $ignore_erros=false)
+ Here is the call graph for this function:

◆ step_3()

ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps::step_3 ( )

Definition at line 89 of file class.ilEmployeeTalkDBUpdateSteps.php.

References ilDBInterface\addTableColumn(), ilDBInterface\tableColumnExists(), and ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps\useTransaction().

89  : void
90  {
91  $this->useTransaction(function (\ilDBInterface $db) {
92  $etalTableName = 'etal_data';
93 
94  if (!$db->tableColumnExists($etalTableName, 'standalone_date')) {
95  $db->addTableColumn(
96  $etalTableName,
97  'standalone_date',
98  [
99  'type' => 'integer',
100  'length' => 1,
101  'notnull' => true,
102  'default' => 0
103  ]
104  );
105  }
106  });
107  }
tableColumnExists(string $table_name, string $column_name)
addTableColumn(string $table_name, string $column_name, array $attributes)
+ Here is the call graph for this function:

◆ step_4()

ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps::step_4 ( )

Definition at line 109 of file class.ilEmployeeTalkDBUpdateSteps.php.

109  : void
110  {
111  // replaced by OrgUnit objectives
112  }

◆ step_5()

ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps::step_5 ( )

Definition at line 114 of file class.ilEmployeeTalkDBUpdateSteps.php.

References ilDBInterface\addPrimaryKey(), ilDBInterface\createTable(), ilDBInterface\tableExists(), and ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps\useTransaction().

114  : void
115  {
116  $this->useTransaction(function (\ilDBInterface $db) {
117  $table_name = 'etal_serie';
118 
119  if (!$db->tableExists($table_name)) {
120  $db->createTable($table_name, [
121  'id' => ['type' => 'integer', 'length' => 8, 'notnull' => true],
122  'editing_locked' => ['type' => 'integer', 'length' => 1, 'notnull' => true],
123  ]);
124 
125  $db->addPrimaryKey($table_name, ['id']);
126  }
127  });
128  }
tableExists(string $table_name)
addPrimaryKey(string $table_name, array $primary_keys)
createTable(string $table_name, array $fields, bool $drop_table=false, bool $ignore_erros=false)
+ Here is the call graph for this function:

◆ step_6()

ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps::step_6 ( )

Definition at line 130 of file class.ilEmployeeTalkDBUpdateSteps.php.

References ilDBInterface\addTableColumn(), ilDBInterface\tableColumnExists(), and ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps\useTransaction().

130  : void
131  {
132  $this->useTransaction(function (\ilDBInterface $db) {
133  $table_name = 'etal_data';
134  $column_name = 'template_id';
135 
136  if (!$db->tableColumnExists($table_name, $column_name)) {
137  $db->addTableColumn(
138  $table_name,
139  $column_name,
140  [
141  'type' => 'integer',
142  'length' => 8,
143  'notnull' => true,
144  'default' => 0
145  ]
146  );
147  }
148  });
149  }
tableColumnExists(string $table_name, string $column_name)
addTableColumn(string $table_name, string $column_name, array $attributes)
+ Here is the call graph for this function:

◆ useTransaction()

ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps::useTransaction ( callable  $updateStep)
private

Definition at line 41 of file class.ilEmployeeTalkDBUpdateSteps.php.

Referenced by ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps\step_2(), ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps\step_3(), ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps\step_5(), and ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps\step_6().

41  : void
42  {
43  try {
44  if ($this->db->supportsTransactions()) {
45  $this->db->beginTransaction();
46  }
47  $updateStep($this->db);
48 
49  if ($this->db->supportsTransactions()) {
50  $this->db->commit();
51  }
52  } catch (\Exception $exception) {
53  if ($this->db->supportsTransactions()) {
54  $this->db->rollback();
55  }
56  throw $exception;
57  }
58  }
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ILIAS\EmployeeTalk\Setup\ilEmployeeTalkDBUpdateSteps::$db
protected

The documentation for this class was generated from the following file: