3 declare(strict_types=1);
    37         return "Migration of some LOM elements that should be non-unique to their own tables.";
    42         return Migration::INFINITE;
    56         $this->db = $environment->
getResource(Environment::RESOURCE_DATABASE);
    58         $io = $environment->
getResource(Environment::RESOURCE_ADMIN_INTERACTION);
   119         return $this->db->indexExistsByFields($table, [
'rbac_id', 
'obj_id']);
   126             $this->db->addIndex($table, [
'rbac_id', 
'obj_id'], 
'i1');
   142         $this->db->setLimit($limit);
   143         $coverages = $this->db->query(
   144             "SELECT meta_general_id, rbac_id, obj_id, obj_type, coverage,   145             coverage_language FROM il_meta_general WHERE CHAR_LENGTH(coverage) > 0   146             OR CHAR_LENGTH(coverage_language) > 0 ORDER BY meta_general_id"   149         while ($coverage = $this->db->fetchAssoc($coverages)) {
   150             $this->
logDetailed(
'Insert coverage from meta_general_id ' . $coverage[
'meta_general_id']);
   151             $next_id = $this->db->nextId(
'il_meta_coverage');
   152             $this->db->manipulate(
   153                 "INSERT INTO il_meta_coverage (meta_coverage_id, rbac_id, obj_id,   154                 obj_type, parent_type, parent_id, coverage, coverage_language) VALUES (" .
   165             $this->db->manipulate(
   166                 "UPDATE il_meta_general SET coverage = '', coverage_language = ''   174         $res = $this->db->query(
   175             "SELECT COUNT(*) AS count FROM il_meta_general WHERE CHAR_LENGTH(coverage) > 0   176             OR CHAR_LENGTH(coverage_language) > 0"   178         while ($rec = $this->db->fetchAssoc(
$res)) {
   179             return (
int) $rec[
'count'];
   196         $this->db->setLimit($limit);
   197         $schemas = $this->db->query(
   198             "SELECT meta_meta_data_id, rbac_id, obj_id, obj_type, meta_data_scheme    199             FROM il_meta_meta_data WHERE CHAR_LENGTH(meta_data_scheme) > 0 ORDER BY meta_meta_data_id"   202         while ($schema = $this->db->fetchAssoc($schemas)) {
   203             $this->
logDetailed(
'Insert schema from meta_meta_data_id ' . $schema[
'meta_meta_data_id']);
   204             $next_id = $this->db->nextId(
'il_meta_meta_schema');
   205             $this->db->manipulate(
   206                 "INSERT INTO il_meta_meta_schema (meta_meta_schema_id, rbac_id, obj_id,   207                 obj_type, parent_type, parent_id, meta_data_schema) VALUES (" .
   217             $this->db->manipulate(
   218                 "UPDATE il_meta_meta_data SET meta_data_scheme = '' WHERE meta_meta_data_id = " .
   226         $res = $this->db->query(
   227             "SELECT COUNT(*) AS count FROM il_meta_meta_data WHERE CHAR_LENGTH(meta_data_scheme) > 0"   229         while ($rec = $this->db->fetchAssoc(
$res)) {
   230             return (
int) $rec[
'count'];
   242         $this->
logSuccess(
'Migrated all orComposites.');
   247         $this->db->setLimit($limit);
   248         $ors = $this->db->query(
   249             "SELECT meta_requirement_id, rbac_id, obj_id, obj_type, operating_system_name,   250             os_min_version, os_max_version, browser_name, browser_minimum_version,   251             browser_maximum_version FROM il_meta_requirement WHERE   252             CHAR_LENGTH(operating_system_name) > 0 OR CHAR_LENGTH(os_min_version) > 0   253             OR CHAR_LENGTH(os_max_version) > 0 OR CHAR_LENGTH(browser_name) > 0   254             OR CHAR_LENGTH(browser_minimum_version) > 0 OR CHAR_LENGTH(browser_maximum_version) > 0   255             ORDER BY meta_requirement_id"   258         while ($or = $this->db->fetchAssoc($ors)) {
   260                 ($or[
'operating_system_name'] ?? 
'') !== 
'' ||
   261                 ($or[
'os_min_version'] ?? 
'') !== 
'' ||
   262                 ($or[
'os_max_version'] ?? 
'') !== 
'';
   264                 ($or[
'browser_name'] ?? 
'') !== 
'' ||
   265                 ($or[
'browser_minimum_version'] ?? 
'') !== 
'' ||
   266                 ($or[
'browser_maximum_version'] ?? 
'') !== 
'';
   269                 $this->
logDetailed(
'Insert orComposite (type os) from meta_requirement_id ' . $or[
'meta_requirement_id']);
   270                 $next_id = $this->db->nextId(
'il_meta_or_composite');
   272                 $this->db->manipulate(
   273                     "INSERT INTO il_meta_or_composite (meta_or_composite_id, rbac_id, obj_id,   274                     obj_type, parent_type, parent_id, type, name, min_version, max_version) VALUES (" .
   287                 $this->db->manipulate(
   288                     "UPDATE il_meta_requirement SET operating_system_name = '', os_min_version = '',   289                     os_max_version = '' WHERE meta_requirement_id = " .
   295                 $this->
logDetailed(
'Insert orComposite (type browser) from meta_requirement_id ' . $or[
'meta_requirement_id']);
   296                 $next_id = $this->db->nextId(
'il_meta_or_composite');
   298                 $this->db->manipulate(
   299                     "INSERT INTO il_meta_or_composite (meta_or_composite_id, rbac_id, obj_id,   300                     obj_type, parent_type, parent_id, type, name, min_version, max_version) VALUES (" .
   313                 $this->db->manipulate(
   314                     "UPDATE il_meta_requirement SET browser_name = '', browser_minimum_version = '',   315                     browser_maximum_version = '' WHERE meta_requirement_id = " .
   324         $res = $this->db->query(
   325             "SELECT COUNT(*) AS count FROM il_meta_requirement WHERE   326             CHAR_LENGTH(operating_system_name) > 0 OR CHAR_LENGTH(os_min_version) > 0   327             OR CHAR_LENGTH(os_max_version) > 0 OR CHAR_LENGTH(browser_name) > 0   328             OR CHAR_LENGTH(browser_minimum_version) > 0 OR CHAR_LENGTH(browser_maximum_version) > 0"   330         while ($rec = $this->db->fetchAssoc(
$res)) {
   331             return (
int) $rec[
'count'];
   340             'NetscapeCommunicator' => 
'netscape communicator',
   341             'MS-InternetExplorer' => 
'ms-internet explorer',
   344             'PC-DOS' => 
'pc-dos',
   345             'MS-Windows' => 
'ms-windows',
   348             'Multi-OS' => 
'multi-os',
   352         if (key_exists($name, $dict)) {
   365         $this->
logSuccess(
'Migrated all learningResourceTypes, intendedEndUserRoles, and contexts.');
   370         $this->db->setLimit($limit);
   371         $educationals = $this->db->query(
   372             "SELECT meta_educational_id, rbac_id, obj_id, obj_type,   373             learning_resource_type, intended_end_user_role, context FROM il_meta_educational   374             WHERE CHAR_LENGTH(learning_resource_type) > 0 OR CHAR_LENGTH(intended_end_user_role) > 0   375             OR CHAR_LENGTH(context) > 0 ORDER BY meta_educational_id"   378         while (
$educational = $this->db->fetchAssoc($educationals)) {
   379             $has_type = (
$educational[
'learning_resource_type'] ?? 
'') !== 
'';
   380             $has_role = (
$educational[
'intended_end_user_role'] ?? 
'') !== 
'';
   384                 $this->
logDetailed(
'Insert learningResourceType from meta_educational_id ' . 
$educational[
'meta_educational_id']);
   385                 $next_id = $this->db->nextId(
'il_meta_lr_type');
   387                 $this->db->manipulate(
   388                     "INSERT INTO il_meta_lr_type (meta_lr_type_id, rbac_id, obj_id, obj_type,   389                     parent_type, parent_id, learning_resource_type) VALUES (" .
   399                 $this->db->manipulate(
   400                     "UPDATE il_meta_educational SET learning_resource_type = '' WHERE meta_educational_id = " .
   406                 $this->
logDetailed(
'Insert intendedEndUserRole from meta_educational_id ' . 
$educational[
'meta_educational_id']);
   407                 $next_id = $this->db->nextId(
'il_meta_end_usr_role');
   409                 $this->db->manipulate(
   410                     "INSERT INTO il_meta_end_usr_role (meta_end_usr_role_id, rbac_id, obj_id, obj_type,   411                     parent_type, parent_id, intended_end_user_role) VALUES (" .
   421                 $this->db->manipulate(
   422                     "UPDATE il_meta_educational SET intended_end_user_role = '' WHERE meta_educational_id = " .
   429                 $next_id = $this->db->nextId(
'il_meta_context');
   431                 $this->db->manipulate(
   432                     "INSERT INTO il_meta_context (meta_context_id, rbac_id, obj_id, obj_type,   433                     parent_type, parent_id, context) VALUES (" .
   443                 $this->db->manipulate(
   444                     "UPDATE il_meta_educational SET context = '' WHERE meta_educational_id = " .
   453         $res = $this->db->query(
   454             "SELECT COUNT(*) AS count FROM il_meta_educational WHERE   455             CHAR_LENGTH(learning_resource_type) > 0 OR CHAR_LENGTH(intended_end_user_role) > 0   456             OR CHAR_LENGTH(context) > 0"   458         while ($rec = $this->db->fetchAssoc(
$res)) {
   459             return (
int) $rec[
'count'];
   467             'Exercise' => 
'exercise',
   468             'Simulation' => 
'simulation',
   469             'Questionnaire' => 
'questionnaire',
   470             'Diagram' => 
'diagram',
   471             'Figure' => 
'figure',
   476             'NarrativeText' => 
'narrative text',
   478             'Experiment' => 
'experiment',
   479             'ProblemStatement' => 
'problem statement',
   480             'SelfAssessment' => 
'self assessment',
   481             'Lecture' => 
'lecture'   484         if (key_exists($name, $dict)) {
   493             'Teacher' => 
'teacher',
   494             'Author' => 
'author',
   495             'Learner' => 
'learner',
   496             'Manager' => 
'manager'   499         if (key_exists($name, $dict)) {
   508             'School' => 
'school',
   509             'HigherEducation' => 
'higher education',
   510             'Training' => 
'training',
   514         if (key_exists($name, $dict)) {
   522         if (!isset($this->io) || !$this->io->isVerbose()) {
   525         $this->io->inform($str);
   530         if (!isset($this->io)) {
   533         $this->io->success($str);
   538         if (!isset($this->io)) {
 
Wrapper around symfonies input and output facilities to provide just the functionality required for t...
 
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
An environment holds resources to be used in the setup process.