ILIAS  trunk Revision v11.0_alpha-1838-g59fc79e306b
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilMDLOMConformanceMigration Class Reference
+ Inheritance diagram for ilMDLOMConformanceMigration:
+ Collaboration diagram for ilMDLOMConformanceMigration:

Public Member Functions

 getLabel ()
 
 getDefaultAmountOfStepsPerRun ()
 
 getPreconditions (Environment $environment)
 
 prepare (Environment $environment)
 
 step (Environment $environment)
 
 getRemainingAmountOfSteps ()
 

Protected Member Functions

 areIndicesSet (string $table)
 
 setIndices (string $table)
 
 migrateCoverage ()
 
 migrateSetOfCoverages (int $limit)
 
 countNotMigratedCoverages ()
 
 migrateSchema ()
 
 migrateSetOfSchemas (int $limit)
 
 countNotMigratedSchemas ()
 
 migrateOrComposite ()
 
 migrateSetOfOrComposites (int $limit)
 
 countNotMigratedOrComposites ()
 
 normalizeOrCompositeName (string $name)
 
 migrateFromEducational ()
 
 migrateSetFromEducational (int $limit)
 
 countNotMigratedFromEducational ()
 
 normalizeLearningResourceType (string $name)
 
 normalizeIntendedEndUserRole (string $name)
 
 normalizeContext (string $name)
 
 logDetailed (string $str)
 
 logSuccess (string $str)
 
 startLog ()
 

Protected Attributes

const int SELECT_LIMIT = 1000
 
const int MAX_LOOPS = 10000
 
ilDBInterface $db
 
IOWrapper $io
 

Detailed Description

Definition at line 26 of file class.ilMDLOMConformanceMigration.php.

Member Function Documentation

◆ areIndicesSet()

ilMDLOMConformanceMigration::areIndicesSet ( string  $table)
protected

Definition at line 116 of file class.ilMDLOMConformanceMigration.php.

Referenced by getRemainingAmountOfSteps(), and setIndices().

116  : bool
117  {
118  return $this->db->indexExistsByFields($table, ['rbac_id', 'obj_id']);
119  }
+ Here is the caller graph for this function:

◆ countNotMigratedCoverages()

ilMDLOMConformanceMigration::countNotMigratedCoverages ( )
protected

Definition at line 171 of file class.ilMDLOMConformanceMigration.php.

References $res.

Referenced by getRemainingAmountOfSteps(), and migrateCoverage().

171  : int
172  {
173  $res = $this->db->query(
174  "SELECT COUNT(*) AS count FROM il_meta_general WHERE CHAR_LENGTH(coverage) > 0
175  OR CHAR_LENGTH(coverage_language) > 0"
176  );
177  while ($rec = $this->db->fetchAssoc($res)) {
178  return (int) $rec['count'];
179  }
180  return 0;
181  }
$res
Definition: ltiservices.php:66
+ Here is the caller graph for this function:

◆ countNotMigratedFromEducational()

ilMDLOMConformanceMigration::countNotMigratedFromEducational ( )
protected

Definition at line 450 of file class.ilMDLOMConformanceMigration.php.

References $res.

Referenced by getRemainingAmountOfSteps(), and migrateFromEducational().

450  : int
451  {
452  $res = $this->db->query(
453  "SELECT COUNT(*) AS count FROM il_meta_educational WHERE
454  CHAR_LENGTH(learning_resource_type) > 0 OR CHAR_LENGTH(intended_end_user_role) > 0
455  OR CHAR_LENGTH(context) > 0"
456  );
457  while ($rec = $this->db->fetchAssoc($res)) {
458  return (int) $rec['count'];
459  }
460  return 0;
461  }
$res
Definition: ltiservices.php:66
+ Here is the caller graph for this function:

◆ countNotMigratedOrComposites()

ilMDLOMConformanceMigration::countNotMigratedOrComposites ( )
protected

Definition at line 321 of file class.ilMDLOMConformanceMigration.php.

References $res.

Referenced by getRemainingAmountOfSteps(), and migrateOrComposite().

321  : int
322  {
323  $res = $this->db->query(
324  "SELECT COUNT(*) AS count FROM il_meta_requirement WHERE
325  CHAR_LENGTH(operating_system_name) > 0 OR CHAR_LENGTH(os_min_version) > 0
326  OR CHAR_LENGTH(os_max_version) > 0 OR CHAR_LENGTH(browser_name) > 0
327  OR CHAR_LENGTH(browser_minimum_version) > 0 OR CHAR_LENGTH(browser_maximum_version) > 0"
328  );
329  while ($rec = $this->db->fetchAssoc($res)) {
330  return (int) $rec['count'];
331  }
332  return 0;
333  }
$res
Definition: ltiservices.php:66
+ Here is the caller graph for this function:

◆ countNotMigratedSchemas()

ilMDLOMConformanceMigration::countNotMigratedSchemas ( )
protected

Definition at line 223 of file class.ilMDLOMConformanceMigration.php.

References $res.

Referenced by getRemainingAmountOfSteps(), and migrateSchema().

223  : int
224  {
225  $res = $this->db->query(
226  "SELECT COUNT(*) AS count FROM il_meta_meta_data WHERE CHAR_LENGTH(meta_data_scheme) > 0"
227  );
228  while ($rec = $this->db->fetchAssoc($res)) {
229  return (int) $rec['count'];
230  }
231  return 0;
232  }
$res
Definition: ltiservices.php:66
+ Here is the caller graph for this function:

◆ getDefaultAmountOfStepsPerRun()

ilMDLOMConformanceMigration::getDefaultAmountOfStepsPerRun ( )

Definition at line 39 of file class.ilMDLOMConformanceMigration.php.

39  : int
40  {
41  return Migration::INFINITE;
42  }

◆ getLabel()

ilMDLOMConformanceMigration::getLabel ( )

Definition at line 34 of file class.ilMDLOMConformanceMigration.php.

34  : string
35  {
36  return "Migration of some LOM elements that should be non-unique to their own tables.";
37  }

◆ getPreconditions()

ilMDLOMConformanceMigration::getPreconditions ( Environment  $environment)

◆ getRemainingAmountOfSteps()

ilMDLOMConformanceMigration::getRemainingAmountOfSteps ( )

Definition at line 82 of file class.ilMDLOMConformanceMigration.php.

References areIndicesSet(), countNotMigratedCoverages(), countNotMigratedFromEducational(), countNotMigratedOrComposites(), and countNotMigratedSchemas().

82  : int
83  {
84  if (
85  $this->countNotMigratedCoverages() > 0 ||
86  !$this->areIndicesSet('il_meta_coverage')
87  ) {
88  return 1;
89  }
90 
91  if (
92  $this->countNotMigratedSchemas() > 0 ||
93  !$this->areIndicesSet('il_meta_meta_schema')
94  ) {
95  return 1;
96  }
97 
98  if (
99  $this->countNotMigratedOrComposites() > 0 ||
100  !$this->areIndicesSet('il_meta_or_composite')
101  ) {
102  return 1;
103  }
104 
105  if (
106  $this->countNotMigratedFromEducational() > 0 ||
107  !$this->areIndicesSet('il_meta_lr_type') ||
108  !$this->areIndicesSet('il_meta_end_usr_role') ||
109  !$this->areIndicesSet('il_meta_context')
110  ) {
111  return 1;
112  }
113  return 0;
114  }
+ Here is the call graph for this function:

◆ logDetailed()

ilMDLOMConformanceMigration::logDetailed ( string  $str)
protected

Definition at line 519 of file class.ilMDLOMConformanceMigration.php.

Referenced by migrateSetFromEducational(), migrateSetOfCoverages(), migrateSetOfOrComposites(), migrateSetOfSchemas(), and setIndices().

519  : void
520  {
521  if (!isset($this->io) || !$this->io->isVerbose()) {
522  return;
523  }
524  $this->io->inform($str);
525  }
+ Here is the caller graph for this function:

◆ logSuccess()

ilMDLOMConformanceMigration::logSuccess ( string  $str)
protected

Definition at line 527 of file class.ilMDLOMConformanceMigration.php.

Referenced by migrateCoverage(), migrateFromEducational(), migrateOrComposite(), and migrateSchema().

527  : void
528  {
529  if (!isset($this->io)) {
530  return;
531  }
532  $this->io->success($str);
533  }
+ Here is the caller graph for this function:

◆ migrateCoverage()

ilMDLOMConformanceMigration::migrateCoverage ( )
protected

Definition at line 129 of file class.ilMDLOMConformanceMigration.php.

References countNotMigratedCoverages(), logSuccess(), and migrateSetOfCoverages().

Referenced by step().

129  : void
130  {
131  $count = 0;
132  while ($this->countNotMigratedCoverages() > 0 && $count < self::MAX_LOOPS) {
133  $this->migrateSetOfCoverages(self::SELECT_LIMIT);
134  $count++;
135  }
136  $this->logSuccess('Migrated all coverages.');
137  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ migrateFromEducational()

ilMDLOMConformanceMigration::migrateFromEducational ( )
protected

Definition at line 357 of file class.ilMDLOMConformanceMigration.php.

References countNotMigratedFromEducational(), logSuccess(), and migrateSetFromEducational().

Referenced by step().

357  : void
358  {
359  $count = 0;
360  while ($this->countNotMigratedFromEducational() > 0 && $count < self::MAX_LOOPS) {
361  $this->migrateSetFromEducational(self::SELECT_LIMIT);
362  $count++;
363  }
364  $this->logSuccess('Migrated all learningResourceTypes, intendedEndUserRoles, and contexts.');
365  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ migrateOrComposite()

ilMDLOMConformanceMigration::migrateOrComposite ( )
protected

Definition at line 234 of file class.ilMDLOMConformanceMigration.php.

References countNotMigratedOrComposites(), logSuccess(), and migrateSetOfOrComposites().

Referenced by step().

234  : void
235  {
236  $count = 0;
237  while ($this->countNotMigratedOrComposites() > 0 && $count < self::MAX_LOOPS) {
238  $this->migrateSetOfOrComposites(self::SELECT_LIMIT);
239  $count++;
240  }
241  $this->logSuccess('Migrated all orComposites.');
242  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ migrateSchema()

ilMDLOMConformanceMigration::migrateSchema ( )
protected

Definition at line 183 of file class.ilMDLOMConformanceMigration.php.

References countNotMigratedSchemas(), logSuccess(), and migrateSetOfSchemas().

Referenced by step().

183  : void
184  {
185  $count = 0;
186  while ($this->countNotMigratedSchemas() > 0 && $count < self::MAX_LOOPS) {
187  $this->migrateSetOfSchemas(self::SELECT_LIMIT);
188  $count++;
189  }
190  $this->logSuccess('Migrated all schemas.');
191  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ migrateSetFromEducational()

ilMDLOMConformanceMigration::migrateSetFromEducational ( int  $limit)
protected

Definition at line 367 of file class.ilMDLOMConformanceMigration.php.

References $context, $educational, logDetailed(), normalizeContext(), normalizeIntendedEndUserRole(), normalizeLearningResourceType(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Referenced by migrateFromEducational().

367  : void
368  {
369  $this->db->setLimit($limit);
370  $educationals = $this->db->query(
371  "SELECT meta_educational_id, rbac_id, obj_id, obj_type,
372  learning_resource_type, intended_end_user_role, context FROM il_meta_educational
373  WHERE CHAR_LENGTH(learning_resource_type) > 0 OR CHAR_LENGTH(intended_end_user_role) > 0
374  OR CHAR_LENGTH(context) > 0 ORDER BY meta_educational_id"
375  );
376 
377  while ($educational = $this->db->fetchAssoc($educationals)) {
378  $has_type = ($educational['learning_resource_type'] ?? '') !== '';
379  $has_role = ($educational['intended_end_user_role'] ?? '') !== '';
380  $has_context = ($educational['context'] ?? '') !== '';
381 
382  if ($has_type) {
383  $this->logDetailed('Insert learningResourceType from meta_educational_id ' . $educational['meta_educational_id']);
384  $next_id = $this->db->nextId('il_meta_lr_type');
385  $type = $this->normalizeLearningResourceType($educational['learning_resource_type']);
386  $this->db->manipulate(
387  "INSERT INTO il_meta_lr_type (meta_lr_type_id, rbac_id, obj_id, obj_type,
388  parent_type, parent_id, learning_resource_type) VALUES (" .
389  $this->db->quote($next_id, ilDBConstants::T_INTEGER) . ", " .
390  $this->db->quote($educational['rbac_id'], ilDBConstants::T_INTEGER) . ", " .
391  $this->db->quote($educational['obj_id'], ilDBConstants::T_INTEGER) . ", " .
392  $this->db->quote($educational['obj_type'], ilDBConstants::T_TEXT) . ", " .
393  $this->db->quote('meta_educational', ilDBConstants::T_TEXT) . ", " .
394  $this->db->quote($educational['meta_educational_id'], ilDBConstants::T_INTEGER) . ", " .
395  $this->db->quote($type, ilDBConstants::T_TEXT) . ")"
396  );
397  $this->logDetailed('Success, deleting old entry');
398  $this->db->manipulate(
399  "UPDATE il_meta_educational SET learning_resource_type = '' WHERE meta_educational_id = " .
400  $this->db->quote($educational['meta_educational_id'], ilDBConstants::T_INTEGER)
401  );
402  }
403 
404  if ($has_role) {
405  $this->logDetailed('Insert intendedEndUserRole from meta_educational_id ' . $educational['meta_educational_id']);
406  $next_id = $this->db->nextId('il_meta_end_usr_role');
407  $role = $this->normalizeIntendedEndUserRole($educational['intended_end_user_role']);
408  $this->db->manipulate(
409  "INSERT INTO il_meta_end_usr_role (meta_end_usr_role_id, rbac_id, obj_id, obj_type,
410  parent_type, parent_id, intended_end_user_role) VALUES (" .
411  $this->db->quote($next_id, ilDBConstants::T_INTEGER) . ", " .
412  $this->db->quote($educational['rbac_id'], ilDBConstants::T_INTEGER) . ", " .
413  $this->db->quote($educational['obj_id'], ilDBConstants::T_INTEGER) . ", " .
414  $this->db->quote($educational['obj_type'], ilDBConstants::T_TEXT) . ", " .
415  $this->db->quote('meta_educational', ilDBConstants::T_TEXT) . ", " .
416  $this->db->quote($educational['meta_educational_id'], ilDBConstants::T_INTEGER) . ", " .
417  $this->db->quote($role, ilDBConstants::T_TEXT) . ")"
418  );
419  $this->logDetailed('Success, deleting old entry');
420  $this->db->manipulate(
421  "UPDATE il_meta_educational SET intended_end_user_role = '' WHERE meta_educational_id = " .
422  $this->db->quote($educational['meta_educational_id'], ilDBConstants::T_INTEGER)
423  );
424  }
425 
426  if ($has_context) {
427  $this->logDetailed('Insert context from meta_educational_id ' . $educational['meta_educational_id']);
428  $next_id = $this->db->nextId('il_meta_context');
429  $context = $this->normalizeContext($educational['context']);
430  $this->db->manipulate(
431  "INSERT INTO il_meta_context (meta_context_id, rbac_id, obj_id, obj_type,
432  parent_type, parent_id, context) VALUES (" .
433  $this->db->quote($next_id, ilDBConstants::T_INTEGER) . ", " .
434  $this->db->quote($educational['rbac_id'], ilDBConstants::T_INTEGER) . ", " .
435  $this->db->quote($educational['obj_id'], ilDBConstants::T_INTEGER) . ", " .
436  $this->db->quote($educational['obj_type'], ilDBConstants::T_TEXT) . ", " .
437  $this->db->quote('meta_educational', ilDBConstants::T_TEXT) . ", " .
438  $this->db->quote($educational['meta_educational_id'], ilDBConstants::T_INTEGER) . ", " .
439  $this->db->quote($context, ilDBConstants::T_TEXT) . ")"
440  );
441  $this->logDetailed('Success, deleting old entry');
442  $this->db->manipulate(
443  "UPDATE il_meta_educational SET context = '' WHERE meta_educational_id = " .
444  $this->db->quote($educational['meta_educational_id'], ilDBConstants::T_INTEGER)
445  );
446  }
447  }
448  }
$context
Definition: webdav.php:31
$educational
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ migrateSetOfCoverages()

ilMDLOMConformanceMigration::migrateSetOfCoverages ( int  $limit)
protected

Definition at line 139 of file class.ilMDLOMConformanceMigration.php.

References logDetailed(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Referenced by migrateCoverage().

139  : void
140  {
141  $this->db->setLimit($limit);
142  $coverages = $this->db->query(
143  "SELECT meta_general_id, rbac_id, obj_id, obj_type, coverage,
144  coverage_language FROM il_meta_general WHERE CHAR_LENGTH(coverage) > 0
145  OR CHAR_LENGTH(coverage_language) > 0 ORDER BY meta_general_id"
146  );
147 
148  while ($coverage = $this->db->fetchAssoc($coverages)) {
149  $this->logDetailed('Insert coverage from meta_general_id ' . $coverage['meta_general_id']);
150  $next_id = $this->db->nextId('il_meta_coverage');
151  $this->db->manipulate(
152  "INSERT INTO il_meta_coverage (meta_coverage_id, rbac_id, obj_id,
153  obj_type, parent_type, parent_id, coverage, coverage_language) VALUES (" .
154  $this->db->quote($next_id, ilDBConstants::T_INTEGER) . ", " .
155  $this->db->quote($coverage['rbac_id'], ilDBConstants::T_INTEGER) . ", " .
156  $this->db->quote($coverage['obj_id'], ilDBConstants::T_INTEGER) . ", " .
157  $this->db->quote($coverage['obj_type'], ilDBConstants::T_TEXT) . ", " .
158  $this->db->quote('meta_general', ilDBConstants::T_TEXT) . ", " .
159  $this->db->quote($coverage['meta_general_id'], ilDBConstants::T_INTEGER) . ", " .
160  $this->db->quote($coverage['coverage'], ilDBConstants::T_TEXT) . ", " .
161  $this->db->quote($coverage['coverage_language'], ilDBConstants::T_TEXT) . ")"
162  );
163  $this->logDetailed('Success, deleting old entry');
164  $this->db->manipulate(
165  "UPDATE il_meta_general SET coverage = '', coverage_language = ''
166  WHERE meta_general_id = " . $this->db->quote($coverage['meta_general_id'], ilDBConstants::T_INTEGER)
167  );
168  }
169  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ migrateSetOfOrComposites()

ilMDLOMConformanceMigration::migrateSetOfOrComposites ( int  $limit)
protected

Definition at line 244 of file class.ilMDLOMConformanceMigration.php.

References logDetailed(), normalizeOrCompositeName(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Referenced by migrateOrComposite().

244  : void
245  {
246  $this->db->setLimit($limit);
247  $ors = $this->db->query(
248  "SELECT meta_requirement_id, rbac_id, obj_id, obj_type, operating_system_name,
249  os_min_version, os_max_version, browser_name, browser_minimum_version,
250  browser_maximum_version FROM il_meta_requirement WHERE
251  CHAR_LENGTH(operating_system_name) > 0 OR CHAR_LENGTH(os_min_version) > 0
252  OR CHAR_LENGTH(os_max_version) > 0 OR CHAR_LENGTH(browser_name) > 0
253  OR CHAR_LENGTH(browser_minimum_version) > 0 OR CHAR_LENGTH(browser_maximum_version) > 0
254  ORDER BY meta_requirement_id"
255  );
256 
257  while ($or = $this->db->fetchAssoc($ors)) {
258  $has_os =
259  ($or['operating_system_name'] ?? '') !== '' ||
260  ($or['os_min_version'] ?? '') !== '' ||
261  ($or['os_max_version'] ?? '') !== '';
262  $has_browser =
263  ($or['browser_name'] ?? '') !== '' ||
264  ($or['browser_minimum_version'] ?? '') !== '' ||
265  ($or['browser_maximum_version'] ?? '') !== '';
266 
267  if ($has_os) {
268  $this->logDetailed('Insert orComposite (type os) from meta_requirement_id ' . $or['meta_requirement_id']);
269  $next_id = $this->db->nextId('il_meta_or_composite');
270  $name = $this->normalizeOrCompositeName($or['operating_system_name']);
271  $this->db->manipulate(
272  "INSERT INTO il_meta_or_composite (meta_or_composite_id, rbac_id, obj_id,
273  obj_type, parent_type, parent_id, type, name, min_version, max_version) VALUES (" .
274  $this->db->quote($next_id, ilDBConstants::T_INTEGER) . ", " .
275  $this->db->quote($or['rbac_id'], ilDBConstants::T_INTEGER) . ", " .
276  $this->db->quote($or['obj_id'], ilDBConstants::T_INTEGER) . ", " .
277  $this->db->quote($or['obj_type'], ilDBConstants::T_TEXT) . ", " .
278  $this->db->quote('meta_requirement', ilDBConstants::T_TEXT) . ", " .
279  $this->db->quote($or['meta_requirement_id'], ilDBConstants::T_INTEGER) . ", " .
280  $this->db->quote('operating system', ilDBConstants::T_TEXT) . ", " .
281  $this->db->quote($or['operating_system_name'], ilDBConstants::T_TEXT) . ", " .
282  $this->db->quote($or['os_min_version'], ilDBConstants::T_TEXT) . ", " .
283  $this->db->quote($or['os_max_version'], ilDBConstants::T_TEXT) . ")"
284  );
285  $this->logDetailed('Success, deleting old entry');
286  $this->db->manipulate(
287  "UPDATE il_meta_requirement SET operating_system_name = '', os_min_version = '',
288  os_max_version = '' WHERE meta_requirement_id = " .
289  $this->db->quote($or['meta_requirement_id'], ilDBConstants::T_INTEGER)
290  );
291  }
292 
293  if ($has_browser) {
294  $this->logDetailed('Insert orComposite (type browser) from meta_requirement_id ' . $or['meta_requirement_id']);
295  $next_id = $this->db->nextId('il_meta_or_composite');
296  $name = $this->normalizeOrCompositeName($or['browser_name']);
297  $this->db->manipulate(
298  "INSERT INTO il_meta_or_composite (meta_or_composite_id, rbac_id, obj_id,
299  obj_type, parent_type, parent_id, type, name, min_version, max_version) VALUES (" .
300  $this->db->quote($next_id, ilDBConstants::T_INTEGER) . ", " .
301  $this->db->quote($or['rbac_id'], ilDBConstants::T_INTEGER) . ", " .
302  $this->db->quote($or['obj_id'], ilDBConstants::T_INTEGER) . ", " .
303  $this->db->quote($or['obj_type'], ilDBConstants::T_TEXT) . ", " .
304  $this->db->quote('meta_requirement', ilDBConstants::T_TEXT) . ", " .
305  $this->db->quote($or['meta_requirement_id'], ilDBConstants::T_INTEGER) . ", " .
306  $this->db->quote('browser', ilDBConstants::T_TEXT) . ", " .
307  $this->db->quote($name, ilDBConstants::T_TEXT) . ", " .
308  $this->db->quote($or['browser_minimum_version'], ilDBConstants::T_TEXT) . ", " .
309  $this->db->quote($or['browser_maximum_version'], ilDBConstants::T_TEXT) . ")"
310  );
311  $this->logDetailed('Success, deleting old entry');
312  $this->db->manipulate(
313  "UPDATE il_meta_requirement SET browser_name = '', browser_minimum_version = '',
314  browser_maximum_version = '' WHERE meta_requirement_id = " .
315  $this->db->quote($or['meta_requirement_id'], ilDBConstants::T_INTEGER)
316  );
317  }
318  }
319  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ migrateSetOfSchemas()

ilMDLOMConformanceMigration::migrateSetOfSchemas ( int  $limit)
protected

Definition at line 193 of file class.ilMDLOMConformanceMigration.php.

References logDetailed(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Referenced by migrateSchema().

193  : void
194  {
195  $this->db->setLimit($limit);
196  $schemas = $this->db->query(
197  "SELECT meta_meta_data_id, rbac_id, obj_id, obj_type, meta_data_scheme
198  FROM il_meta_meta_data WHERE CHAR_LENGTH(meta_data_scheme) > 0 ORDER BY meta_meta_data_id"
199  );
200 
201  while ($schema = $this->db->fetchAssoc($schemas)) {
202  $this->logDetailed('Insert schema from meta_meta_data_id ' . $schema['meta_meta_data_id']);
203  $next_id = $this->db->nextId('il_meta_meta_schema');
204  $this->db->manipulate(
205  "INSERT INTO il_meta_meta_schema (meta_meta_schema_id, rbac_id, obj_id,
206  obj_type, parent_type, parent_id, meta_data_schema) VALUES (" .
207  $this->db->quote($next_id, ilDBConstants::T_INTEGER) . ", " .
208  $this->db->quote($schema['rbac_id'], ilDBConstants::T_INTEGER) . ", " .
209  $this->db->quote($schema['obj_id'], ilDBConstants::T_INTEGER) . ", " .
210  $this->db->quote($schema['obj_type'], ilDBConstants::T_TEXT) . ", " .
211  $this->db->quote('meta_meta_data', ilDBConstants::T_TEXT) . ", " .
212  $this->db->quote($schema['meta_meta_data_id'], ilDBConstants::T_INTEGER) . ", " .
213  $this->db->quote('LOMv1.0', ilDBConstants::T_TEXT) . ")"
214  );
215  $this->logDetailed('Success, deleting old entry');
216  $this->db->manipulate(
217  "UPDATE il_meta_meta_data SET meta_data_scheme = '' WHERE meta_meta_data_id = " .
218  $this->db->quote($schema['meta_meta_data_id'], ilDBConstants::T_INTEGER)
219  );
220  }
221  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ normalizeContext()

ilMDLOMConformanceMigration::normalizeContext ( string  $name)
protected

Definition at line 504 of file class.ilMDLOMConformanceMigration.php.

Referenced by migrateSetFromEducational().

504  : string
505  {
506  $dict = [
507  'School' => 'school',
508  'HigherEducation' => 'higher education',
509  'Training' => 'training',
510  'Other' => 'other'
511  ];
512 
513  if (key_exists($name, $dict)) {
514  return $dict[$name];
515  }
516  return $name;
517  }
+ Here is the caller graph for this function:

◆ normalizeIntendedEndUserRole()

ilMDLOMConformanceMigration::normalizeIntendedEndUserRole ( string  $name)
protected

Definition at line 489 of file class.ilMDLOMConformanceMigration.php.

Referenced by migrateSetFromEducational().

489  : string
490  {
491  $dict = [
492  'Teacher' => 'teacher',
493  'Author' => 'author',
494  'Learner' => 'learner',
495  'Manager' => 'manager'
496  ];
497 
498  if (key_exists($name, $dict)) {
499  return $dict[$name];
500  }
501  return $name;
502  }
+ Here is the caller graph for this function:

◆ normalizeLearningResourceType()

ilMDLOMConformanceMigration::normalizeLearningResourceType ( string  $name)
protected

Definition at line 463 of file class.ilMDLOMConformanceMigration.php.

Referenced by migrateSetFromEducational().

463  : string
464  {
465  $dict = [
466  'Exercise' => 'exercise',
467  'Simulation' => 'simulation',
468  'Questionnaire' => 'questionnaire',
469  'Diagram' => 'diagram',
470  'Figure' => 'figure',
471  'Graph' => 'graph',
472  'Index' => 'index',
473  'Slide' => 'slide',
474  'Table' => 'table',
475  'NarrativeText' => 'narrative text',
476  'Exam' => 'exam',
477  'Experiment' => 'experiment',
478  'ProblemStatement' => 'problem statement',
479  'SelfAssessment' => 'self assessment',
480  'Lecture' => 'lecture'
481  ];
482 
483  if (key_exists($name, $dict)) {
484  return $dict[$name];
485  }
486  return $name;
487  }
+ Here is the caller graph for this function:

◆ normalizeOrCompositeName()

ilMDLOMConformanceMigration::normalizeOrCompositeName ( string  $name)
protected

Definition at line 335 of file class.ilMDLOMConformanceMigration.php.

Referenced by migrateSetOfOrComposites().

335  : string
336  {
337  $dict = [
338  'Any' => 'any',
339  'NetscapeCommunicator' => 'netscape communicator',
340  'MS-InternetExplorer' => 'ms-internet explorer',
341  'Opera' => 'opera',
342  'Amaya' => 'amaya',
343  'PC-DOS' => 'pc-dos',
344  'MS-Windows' => 'ms-windows',
345  'MAC-OS' => 'macos',
346  'Unix' => 'unix',
347  'Multi-OS' => 'multi-os',
348  'None' => 'none'
349  ];
350 
351  if (key_exists($name, $dict)) {
352  return $dict[$name];
353  }
354  return $name;
355  }
+ Here is the caller graph for this function:

◆ prepare()

ilMDLOMConformanceMigration::prepare ( Environment  $environment)

Definition at line 53 of file class.ilMDLOMConformanceMigration.php.

References $io, and ILIAS\Setup\Environment\getResource().

53  : void
54  {
55  $this->db = $environment->getResource(Environment::RESOURCE_DATABASE);
56 
57  $io = $environment->getResource(Environment::RESOURCE_ADMIN_INTERACTION);
58  if ($io instanceof IOWrapper) {
59  $this->io = $io;
60  }
61  }
Wrapper around symfonies input and output facilities to provide just the functionality required for t...
Definition: IOWrapper.php:32
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
+ Here is the call graph for this function:

◆ setIndices()

ilMDLOMConformanceMigration::setIndices ( string  $table)
protected

Definition at line 121 of file class.ilMDLOMConformanceMigration.php.

References areIndicesSet(), and logDetailed().

Referenced by step().

121  : void
122  {
123  if (!$this->areIndicesSet($table)) {
124  $this->logDetailed('Set index for ' . $table);
125  $this->db->addIndex($table, ['rbac_id', 'obj_id'], 'i1');
126  }
127  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startLog()

ilMDLOMConformanceMigration::startLog ( )
protected

Definition at line 535 of file class.ilMDLOMConformanceMigration.php.

Referenced by step().

535  : void
536  {
537  if (!isset($this->io)) {
538  return;
539  }
540  $this->io->text('');
541  }
+ Here is the caller graph for this function:

◆ step()

ilMDLOMConformanceMigration::step ( Environment  $environment)

Definition at line 63 of file class.ilMDLOMConformanceMigration.php.

References migrateCoverage(), migrateFromEducational(), migrateOrComposite(), migrateSchema(), setIndices(), and startLog().

63  : void
64  {
65  $this->startLog();
66 
67  $this->migrateCoverage(); // general > coverage
68  $this->setIndices('il_meta_coverage');
69 
70  $this->migrateSchema(); // metaMetadata > metadataSchema
71  $this->setIndices('il_meta_meta_schema');
72 
73  $this->migrateOrComposite(); // technical > requirement > orComposite
74  $this->setIndices('il_meta_or_composite');
75 
76  $this->migrateFromEducational();// educational > learningResourceType, intendedEndUserRole, context
77  $this->setIndices('il_meta_lr_type');
78  $this->setIndices('il_meta_end_usr_role');
79  $this->setIndices('il_meta_context');
80  }
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilMDLOMConformanceMigration::$db
protected

Definition at line 31 of file class.ilMDLOMConformanceMigration.php.

◆ $io

IOWrapper ilMDLOMConformanceMigration::$io
protected

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

Referenced by prepare().

◆ MAX_LOOPS

const int ilMDLOMConformanceMigration::MAX_LOOPS = 10000
protected

Definition at line 29 of file class.ilMDLOMConformanceMigration.php.

◆ SELECT_LIMIT

const int ilMDLOMConformanceMigration::SELECT_LIMIT = 1000
protected

Definition at line 28 of file class.ilMDLOMConformanceMigration.php.


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