ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilECSUpdateSteps9 Class Reference

Class ilECSUpdateSteps9 contains update steps for release 9. More...

+ Inheritance diagram for ilECSUpdateSteps9:
+ Collaboration diagram for ilECSUpdateSteps9:

Public Member Functions

 prepare (ilDBInterface $db)
 
 step_1 ()
 Fix wrong data entries in ecs_course_assignments. More...
 
 step_2 ()
 
 step_3 ()
 
- Public Member Functions inherited from ilDatabaseUpdateSteps
 prepare (\ilDBInterface $db)
 Prepare the execution of the steps. More...
 

Protected Attributes

ilDBInterface $db
 

Private Member Functions

 ensure_index_exists (string $table, array $fields, string $name)
 
 ensure_indices_exist ()
 
 fix_duplicate_import_types (string $types)
 

Detailed Description

Class ilECSUpdateSteps9 contains update steps for release 9.

Author
Per Pascal Seeland pasca.nosp@m.l.se.nosp@m.eland.nosp@m.@tik.nosp@m..uni-.nosp@m.stut.nosp@m.tgart.nosp@m..de

Definition at line 25 of file ilECSUpdateSteps9.php.

Member Function Documentation

◆ ensure_index_exists()

ilECSUpdateSteps9::ensure_index_exists ( string  $table,
array  $fields,
string  $name 
)
private

Definition at line 29 of file ilECSUpdateSteps9.php.

29 : void
30 {
31 if (!$this->db->indexExistsByFields($table, $fields)) {
32 $this->db->addIndex($table, $fields, $name);
33 }
34 }

Referenced by ensure_indices_exist().

+ Here is the caller graph for this function:

◆ ensure_indices_exist()

ilECSUpdateSteps9::ensure_indices_exist ( )
private

Definition at line 36 of file ilECSUpdateSteps9.php.

36 : void
37 {
38 $this->ensure_index_exists('ecs_course_assignments', ['obj_id'], 'i1');
39 $this->ensure_index_exists('ecs_import', ['obj_id'], 'i1');
40 $this->ensure_index_exists('ecs_import', ['sub_id'], 'i2');
41 }
ensure_index_exists(string $table, array $fields, string $name)

References ensure_index_exists().

Referenced by step_1(), and step_2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fix_duplicate_import_types()

ilECSUpdateSteps9::fix_duplicate_import_types ( string  $types)
private

Definition at line 43 of file ilECSUpdateSteps9.php.

43 : string
44 {
45 $pattern = '/^(a:\d+:\{.*\})\1+$/s';
46 return (preg_match($pattern, $types, $matches)) ? $matches[1] : $types;
47 }

Referenced by step_3().

+ Here is the caller graph for this function:

◆ prepare()

ilECSUpdateSteps9::prepare ( ilDBInterface  $db)

Definition at line 49 of file ilECSUpdateSteps9.php.

49 : void
50 {
51 $this->db = $db;
52 }

References $db.

◆ step_1()

ilECSUpdateSteps9::step_1 ( )

Fix wrong data entries in ecs_course_assignments.

Definition at line 57 of file ilECSUpdateSteps9.php.

57 : void
58 {
59 $this->ensure_indices_exist();
60 $this->db->manipulate('UPDATE `ecs_course_assignments` inner join ecs_import on ecs_course_assignments.obj_id = ecs_import.obj_id SET ecs_course_assignments.`cms_sub_id`=ecs_import.sub_id WHERE ecs_import.sub_id is null;');
61 }

References ensure_indices_exist().

+ Here is the call graph for this function:

◆ step_2()

ilECSUpdateSteps9::step_2 ( )

step_1 was initially without ensure_indices_exist. Ensure that everyone has these indices, even if step_1 has already been executed

Definition at line 63 of file ilECSUpdateSteps9.php.

63 : void
64 {
69 $this->ensure_indices_exist();
70 }

References ensure_indices_exist().

+ Here is the call graph for this function:

◆ step_3()

ilECSUpdateSteps9::step_3 ( )

Definition at line 72 of file ilECSUpdateSteps9.php.

72 : void
73 {
74 $query = 'SELECT sid, mid, import_types FROM ecs_part_settings';
75 $rows = $this->db->query($query);
76 while ($row = $rows->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
77 $fixed = $this->fix_duplicate_import_types($row->import_types);
78 if ($row->import_types !== $fixed) {
79 $update_query = 'UPDATE ecs_part_settings SET ' .
80 'import_types = ' . $this->db->quote($fixed, ilDBConstants::T_TEXT) . ' ' .
81 'WHERE sid = ' . $row->sid . ' ' .
82 'AND mid = ' . $row->mid;
83 $this->db->manipulate($update_query);
84 }
85 }
86 }
fix_duplicate_import_types(string $types)

References ilDBConstants\FETCHMODE_OBJECT, fix_duplicate_import_types(), and ilDBConstants\T_TEXT.

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilECSUpdateSteps9::$db
protected

Definition at line 27 of file ilECSUpdateSteps9.php.

Referenced by prepare().


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