ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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 26 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 30 of file class.ilEmployeeTalkDBUpdateSteps.php.

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

30  : void
31  {
32  $this->db = $db;
33  }

◆ step_1()

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

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

54  : void
55  {
56  // removed this content in favour of a ilTreeAdminNodeAddedObjective
57  }

◆ step_2()

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

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

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

59  : void
60  {
61  $this->useTransaction(function (\ilDBInterface $db) {
62  $etalTableName = 'etal_data';
63 
64  if (!$db->tableExists($etalTableName)) {
65  $db->createTable($etalTableName, [
66  'object_id' => ['type' => 'integer', 'length' => 8, 'notnull' => true],
67  'series_id' => ['type' => 'text', 'length' => 36, 'notnull' => true, 'fixed' => true],
68  'start_date' => ['type' => 'integer', 'length' => 8, 'notnull' => true],
69  'end_date' => ['type' => 'integer', 'length' => 8, 'notnull' => true],
70  'all_day' => ['type' => 'integer', 'length' => 1, 'notnull' => true],
71  'employee' => ['type' => 'integer', 'length' => 8, 'notnull' => true],
72  'location' => ['type' => 'text', 'length' => 200, 'notnull' => false, 'fixed' => false],
73  'completed' => ['type' => 'integer', 'length' => 1, 'notnull' => true]
74  ]);
75 
76  $db->addPrimaryKey($etalTableName, ['object_id']);
77  $db->addIndex($etalTableName, ['series_id'], 'ser');
78  $db->addIndex($etalTableName, ['employee'], 'emp');
79  }
80  });
81  }
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 83 of file class.ilEmployeeTalkDBUpdateSteps.php.

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

83  : void
84  {
85  $this->useTransaction(function (\ilDBInterface $db) {
86  $etalTableName = 'etal_data';
87 
88  if (!$db->tableColumnExists($etalTableName, 'standalone_date')) {
89  $db->addTableColumn(
90  $etalTableName,
91  'standalone_date',
92  [
93  'type' => 'integer',
94  'length' => 1,
95  'notnull' => true,
96  'default' => 0
97  ]
98  );
99  }
100  });
101  }
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 103 of file class.ilEmployeeTalkDBUpdateSteps.php.

103  : void
104  {
105  // replaced by OrgUnit objectives
106  }

◆ step_5()

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

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

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

108  : void
109  {
110  $this->useTransaction(function (\ilDBInterface $db) {
111  $table_name = 'etal_serie';
112 
113  if (!$db->tableExists($table_name)) {
114  $db->createTable($table_name, [
115  'id' => ['type' => 'integer', 'length' => 8, 'notnull' => true],
116  'editing_locked' => ['type' => 'integer', 'length' => 1, 'notnull' => true],
117  ]);
118 
119  $db->addPrimaryKey($table_name, ['id']);
120  }
121  });
122  }
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 124 of file class.ilEmployeeTalkDBUpdateSteps.php.

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

124  : void
125  {
126  $this->useTransaction(function (\ilDBInterface $db) {
127  $table_name = 'etal_data';
128  $column_name = 'template_id';
129 
130  if (!$db->tableColumnExists($table_name, $column_name)) {
131  $db->addTableColumn(
132  $table_name,
133  $column_name,
134  [
135  'type' => 'integer',
136  'length' => 8,
137  'notnull' => true,
138  'default' => 0
139  ]
140  );
141  }
142  });
143  }
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 35 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().

35  : void
36  {
37  try {
38  if ($this->db->supportsTransactions()) {
39  $this->db->beginTransaction();
40  }
41  $updateStep($this->db);
42 
43  if ($this->db->supportsTransactions()) {
44  $this->db->commit();
45  }
46  } catch (\Exception $exception) {
47  if ($this->db->supportsTransactions()) {
48  $this->db->rollback();
49  }
50  throw $exception;
51  }
52  }
+ 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: