ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration Class Reference
+ Inheritance diagram for ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration:
+ Collaboration diagram for ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration:

Public Member Functions

 getLabel ()
 
 getDefaultAmountOfStepsPerRun ()
 Tell the default amount of steps to be executed for one run of the migration. More...
 
 getPreconditions (Environment $environment)
 Objectives the migration depend on. More...
 
 prepare (Environment $environment)
 Prepare the migration by means of some environment. More...
 
 step (Environment $environment)
 Run one step of the migration. More...
 
 getRemainingAmountOfSteps ()
 Count up how many "things" need to be migrated. More...
 
 getLabel ()
 
 getDefaultAmountOfStepsPerRun ()
 Tell the default amount of steps to be executed for one run of the migration. More...
 
 getPreconditions (Environment $environment)
 Objectives the migration depend on. More...
 
 prepare (Environment $environment)
 Prepare the migration by means of some environment. More...
 
 step (Environment $environment)
 Run one step of the migration. More...
 
 getRemainingAmountOfSteps ()
 Count up how many "things" need to be migrated. More...
 

Protected Attributes

ilDBInterface $db
 

Private Member Functions

 remainingObjectData ()
 
 stepObjectData ()
 
 remainingRbac ()
 
 stepRbac ()
 
 rbacTemplateRowExists (int $rol_id, int $ops_id, int $parent, string $type)
 
 remainingContainerSorting ()
 
 stepContainerSorting ()
 
 remainingSettings ()
 
 stepSettings ()
 
 settingsKeywordExists (string $keyword, string $module)
 
 remainingDesktopItem ()
 
 stepDesktopItem ()
 
 remainingLegacy ()
 
 stepLegacy ()
 
 legacyTableReady (string $table, array $columns)
 
 fetchLegacyOne (string $table, array $spec)
 
 legacyTypeIsInPrimaryKey (array $spec)
 
 legacyDestinationExists (string $table, array $spec, array $row)
 
 legacySourceWhere (array $spec, array $row)
 
 legacyQuoteColumn (string $column, mixed $value)
 
 rbacCreateOperationOld ()
 
 rbacCreateOperationNew ()
 

Private Attributes

const string OLD_TYPE = 'itgr'
 
const string NEW_TYPE = 'obgr'
 
const array SETTINGS_KEY_MAP
 
const array LEGACY_TARGETS
 
const array LEGACY_TEXT_COLUMNS
 

Additional Inherited Members

- Data Fields inherited from ILIAS\Setup\Migration
const INFINITE = -1
 

Detailed Description

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

Member Function Documentation

◆ fetchLegacyOne()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::fetchLegacyOne ( string  $table,
array  $spec 
)
private
Parameters
array{pklist<string>, columns: list<string>} $spec
Returns
array<string, mixed>|null

Definition at line 616 of file class.ilObjectGroupRebrandMigration.php.

616 : ?array
617 {
618 $select = implode(
619 ', ',
620 array_values(
621 array_unique(
622 array_merge(
623 $spec['pk'],
624 $spec['columns']
625 )
626 )
627 )
628 );
629 $conditions = implode(
630 ' OR ',
631 array_map(
632 fn(string $column): string => "{$column} = {$this->db->quote(self::OLD_TYPE, ilDBConstants::T_TEXT)}",
633 $spec['columns']
634 )
635 );
636
637 $result = $this->db->query("SELECT {$select} FROM {$table} WHERE {$conditions} LIMIT 1");
638 $row = $this->db->fetchAssoc($result);
639
640 return $row === null ? null : $row;
641 }

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepLegacy().

+ Here is the caller graph for this function:

◆ getDefaultAmountOfStepsPerRun()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::getDefaultAmountOfStepsPerRun ( )

Tell the default amount of steps to be executed for one run of the migration.

Return Migration::INFINITE if all units should be migrated at once.

Implements ILIAS\Setup\Migration.

Definition at line 213 of file class.ilObjectGroupRebrandMigration.php.

213 : int
214 {
215 return Migration::INFINITE;
216 }

References ILIAS\Setup\Migration\INFINITE.

◆ getLabel()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::getLabel ( )
Returns
string - a meaningful and concise description for your migration.

Implements ILIAS\Setup\Migration.

Definition at line 208 of file class.ilObjectGroupRebrandMigration.php.

208 : string
209 {
210 return 'Rebrand Item Group (itgr) to Object Group (obgr) in stored data.';
211 }

◆ getPreconditions()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::getPreconditions ( Environment  $environment)

Objectives the migration depend on.

Exceptions
UnachievableExceptionif the objective is not achievable
Returns
Objective[]

Implements ILIAS\Setup\Migration.

Definition at line 218 of file class.ilObjectGroupRebrandMigration.php.

218 : array
219 {
220 return [
221 new ilDatabaseUpdateStepsExecutedObjective(new ilObjectGroupDBUpdateSteps()),
222 ];
223 }
This class attempt to achieve a set of database update steps.

◆ getRemainingAmountOfSteps()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::getRemainingAmountOfSteps ( )

Count up how many "things" need to be migrated.

This helps the admin to decide how big he can create the steps and also how long a migration takes

Implements ILIAS\Setup\Migration.

Definition at line 243 of file class.ilObjectGroupRebrandMigration.php.

References ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingContainerSorting(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingDesktopItem(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingLegacy(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingObjectData(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingRbac(), and ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingSettings().

+ Here is the call graph for this function:

◆ legacyDestinationExists()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::legacyDestinationExists ( string  $table,
array  $spec,
array  $row 
)
private
Parameters
array{pklist<string>, columns: list<string>} $spec
array<string,mixed>$row

Definition at line 655 of file class.ilObjectGroupRebrandMigration.php.

655 : bool
656 {
657 $where = [];
658 foreach ($spec['pk'] as $column) {
659 $value = $row[$column];
660 if (in_array($column, $spec['columns'], true) && (string) $value === self::OLD_TYPE) {
661 $value = self::NEW_TYPE;
662 }
663 $where[] = "{$column} = {$this->legacyQuoteColumn($column, $value)}";
664 }
665
666 $result = $this->db->query("SELECT 1 FROM {$table} WHERE " . implode(' AND ', $where) . ' LIMIT 1');
667
668 return $this->db->fetchAssoc($result) !== null;
669 }

References ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\NEW_TYPE.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepLegacy().

+ Here is the caller graph for this function:

◆ legacyQuoteColumn()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::legacyQuoteColumn ( string  $column,
mixed  $value 
)
private

Definition at line 686 of file class.ilObjectGroupRebrandMigration.php.

686 : string
687 {
688 return in_array($column, self::LEGACY_TEXT_COLUMNS, true)
689 ? $this->db->quote((string) $value, ilDBConstants::T_TEXT)
690 : $this->db->quote((int) $value, ilDBConstants::T_INTEGER);
691 }

References ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

◆ legacySourceWhere()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::legacySourceWhere ( array  $spec,
array  $row 
)
private
Parameters
array{pklist<string>, columns: list<string>} $spec
array<string,mixed>$row

Definition at line 675 of file class.ilObjectGroupRebrandMigration.php.

675 : string
676 {
677 return implode(
678 ' AND ',
679 array_map(
680 fn(string $column): string => "{$column} = {$this->legacyQuoteColumn($column, $row[$column])}",
681 $spec['pk']
682 )
683 );
684 }

◆ legacyTableReady()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::legacyTableReady ( string  $table,
array  $columns 
)
private
Parameters
list<string>$columns

Definition at line 595 of file class.ilObjectGroupRebrandMigration.php.

595 : bool
596 {
597 if (!$this->db->tableExists($table)) {
598 return false;
599 }
600
601 foreach ($columns as $column) {
602 if ($this->db->tableColumnExists($table, $column)) {
603 continue;
604 }
605
606 return false;
607 }
608
609 return true;
610 }

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingLegacy(), and ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepLegacy().

+ Here is the caller graph for this function:

◆ legacyTypeIsInPrimaryKey()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::legacyTypeIsInPrimaryKey ( array  $spec)
private
Parameters
array{pklist<string>, columns: list<string>} $spec

Definition at line 646 of file class.ilObjectGroupRebrandMigration.php.

646 : bool
647 {
648 return array_intersect($spec['pk'], $spec['columns']) !== [];
649 }

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepLegacy().

+ Here is the caller graph for this function:

◆ prepare()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::prepare ( Environment  $environment)

Prepare the migration by means of some environment.

This is not supposed to modify the environment, but will be run to prime the migration object to run step and getRemainingAmountOfSteps afterwards.

Implements ILIAS\Setup\Migration.

Definition at line 225 of file class.ilObjectGroupRebrandMigration.php.

225 : void
226 {
227 $this->db = $environment->getResource(Environment::RESOURCE_DATABASE);
228 }

References ILIAS\Setup\Environment\getResource(), and ILIAS\Setup\Environment\RESOURCE_DATABASE.

+ Here is the call graph for this function:

◆ rbacCreateOperationNew()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::rbacCreateOperationNew ( )
private

Definition at line 698 of file class.ilObjectGroupRebrandMigration.php.

698 : string
699 {
700 return 'create_' . self::NEW_TYPE;
701 }

References ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\NEW_TYPE.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepRbac().

+ Here is the caller graph for this function:

◆ rbacCreateOperationOld()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::rbacCreateOperationOld ( )
private

◆ rbacTemplateRowExists()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::rbacTemplateRowExists ( int  $rol_id,
int  $ops_id,
int  $parent,
string  $type 
)
private

Definition at line 393 of file class.ilObjectGroupRebrandMigration.php.

393 : bool
394 {
395 $result = $this->db->queryF(
396 'SELECT 1 FROM rbac_templates WHERE rol_id = %s AND ops_id = %s AND parent = %s AND type = %s LIMIT 1',
397 [
402 ],
403 [$rol_id, $ops_id, $parent, $type]
404 );
405
406 return $this->db->fetchAssoc($result) !== null;
407 }

References ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepRbac().

+ Here is the caller graph for this function:

◆ remainingContainerSorting()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::remainingContainerSorting ( )
private

Definition at line 409 of file class.ilObjectGroupRebrandMigration.php.

409 : int
410 {
411 $result = $this->db->queryF(
412 'SELECT COUNT(*) AS cnt FROM container_sorting WHERE parent_type = %s',
414 [self::OLD_TYPE]
415 );
416
417 return (int) ($this->db->fetchObject($result)?->cnt ?? 0);
418 }

References ilDBConstants\T_TEXT.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\getRemainingAmountOfSteps(), and ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\step().

+ Here is the caller graph for this function:

◆ remainingDesktopItem()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::remainingDesktopItem ( )
private

Definition at line 499 of file class.ilObjectGroupRebrandMigration.php.

499 : int
500 {
501 $result = $this->db->queryF(
502 'SELECT COUNT(*) AS cnt FROM desktop_item WHERE type = %s',
504 [self::OLD_TYPE]
505 );
506
507 return (int) ($this->db->fetchObject($result)?->cnt ?? 0);
508 }

References ilDBConstants\T_TEXT.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\getRemainingAmountOfSteps(), and ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\step().

+ Here is the caller graph for this function:

◆ remainingLegacy()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::remainingLegacy ( )
private

Definition at line 532 of file class.ilObjectGroupRebrandMigration.php.

532 : int
533 {
534 $count = 0;
535 foreach (self::LEGACY_TARGETS as $table => $spec) {
536 if (!$this->legacyTableReady($table, $spec['columns'])) {
537 continue;
538 }
539
540 $conditions = implode(
541 ' OR ',
542 array_map(
543 fn(string $column): string => "{$column} = {$this->db->quote(self::OLD_TYPE, ilDBConstants::T_TEXT)}",
544 $spec['columns']
545 )
546 );
547
548 $result = $this->db->query("SELECT COUNT(*) AS cnt FROM {$table} WHERE {$conditions}");
549 $count += (int) ($this->db->fetchObject($result)?->cnt ?? 0);
550 }
551
552 return $count;
553 }

References ILIAS\Repository\int(), and ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\legacyTableReady().

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\getRemainingAmountOfSteps(), and ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\step().

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

◆ remainingObjectData()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::remainingObjectData ( )
private

Definition at line 258 of file class.ilObjectGroupRebrandMigration.php.

258 : int
259 {
260 $result = $this->db->queryF(
261 'SELECT COUNT(obj_id) AS cnt FROM object_data WHERE type = %s',
263 [self::OLD_TYPE]
264 );
265 $count = (int) ($this->db->fetchObject($result)?->cnt ?? 0);
266
267 $typ_result = $this->db->queryF(
268 'SELECT COUNT(obj_id) AS cnt FROM object_data WHERE type = %s AND title = %s',
270 ['typ', self::OLD_TYPE]
271 );
272 $typ_count = (int) ($this->db->fetchObject($typ_result)?->cnt ?? 0);
273
274 return $count + $typ_count;
275 }

References ILIAS\Repository\int(), and ilDBConstants\T_TEXT.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\getRemainingAmountOfSteps(), and ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\step().

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

◆ remainingRbac()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::remainingRbac ( )
private

Definition at line 314 of file class.ilObjectGroupRebrandMigration.php.

314 : int
315 {
316 $ops_result = $this->db->queryF(
317 'SELECT COUNT(ops_id) AS cnt FROM rbac_operations WHERE operation = %s',
319 [$this->rbacCreateOperationOld()]
320 );
321 $ops_count = (int) ($this->db->fetchObject($ops_result)?->cnt ?? 0);
322
323 $template_result = $this->db->queryF(
324 'SELECT COUNT(*) AS cnt FROM rbac_templates WHERE type = %s',
326 [self::OLD_TYPE]
327 );
328 $template_count = (int) ($this->db->fetchObject($template_result)?->cnt ?? 0);
329
330 return $ops_count + $template_count;
331 }

References ILIAS\Repository\int(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\rbacCreateOperationOld(), and ilDBConstants\T_TEXT.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\getRemainingAmountOfSteps(), and ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\step().

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

◆ remainingSettings()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::remainingSettings ( )
private

Definition at line 443 of file class.ilObjectGroupRebrandMigration.php.

443 : int
444 {
445 $count = 0;
446 foreach (self::SETTINGS_KEY_MAP as $old_key => $_) {
447 $result = $this->db->queryF(
448 'SELECT COUNT(*) AS cnt FROM settings WHERE keyword = %s',
450 [$old_key]
451 );
452 $count += (int) ($this->db->fetchObject($result)?->cnt ?? 0);
453 }
454
455 return $count;
456 }

References ILIAS\Repository\int(), and ilDBConstants\T_TEXT.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\getRemainingAmountOfSteps(), and ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\step().

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

◆ settingsKeywordExists()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::settingsKeywordExists ( string  $keyword,
string  $module 
)
private

Definition at line 488 of file class.ilObjectGroupRebrandMigration.php.

488 : bool
489 {
490 $result = $this->db->queryF(
491 'SELECT 1 FROM settings WHERE module = %s AND keyword = %s LIMIT 1',
493 [$module, $keyword]
494 );
495
496 return $this->db->fetchAssoc($result) !== null;
497 }
if(!isset($arguments[0])) if(count( $arguments) > 3) if(! $remove_from_lang &&isset($arguments[2]) &&!is_dir($arguments[2])) $module

References $module, and ilDBConstants\T_TEXT.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepSettings().

+ Here is the caller graph for this function:

◆ step()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::step ( Environment  $environment)

Run one step of the migration.

Implements ILIAS\Setup\Migration.

Definition at line 230 of file class.ilObjectGroupRebrandMigration.php.

References ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingContainerSorting(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingDesktopItem(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingLegacy(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingObjectData(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingRbac(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\remainingSettings(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepContainerSorting(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepDesktopItem(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepLegacy(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepObjectData(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepRbac(), and ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\stepSettings().

+ Here is the call graph for this function:

◆ stepContainerSorting()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::stepContainerSorting ( )
private

Definition at line 420 of file class.ilObjectGroupRebrandMigration.php.

420 : void
421 {
422 $result = $this->db->queryF(
423 'SELECT parent_id, parent_type, child_id FROM container_sorting WHERE parent_type = %s LIMIT 1',
425 [self::OLD_TYPE]
426 );
427 $row = $this->db->fetchAssoc($result);
428 if ($row === null) {
429 return;
430 }
431
432 $this->db->update(
433 'container_sorting',
434 ['parent_type' => [ilDBConstants::T_TEXT, self::NEW_TYPE]],
435 [
436 'parent_id' => [ilDBConstants::T_INTEGER, (int) $row['parent_id']],
437 'parent_type' => [ilDBConstants::T_TEXT, self::OLD_TYPE],
438 'child_id' => [ilDBConstants::T_INTEGER, (int) $row['child_id']],
439 ]
440 );
441 }

References ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\step().

+ Here is the caller graph for this function:

◆ stepDesktopItem()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::stepDesktopItem ( )
private

Definition at line 510 of file class.ilObjectGroupRebrandMigration.php.

510 : void
511 {
512 $result = $this->db->queryF(
513 'SELECT item_id, user_id FROM desktop_item WHERE type = %s LIMIT 1',
515 [self::OLD_TYPE]
516 );
517 $row = $this->db->fetchAssoc($result);
518 if ($row === null) {
519 return;
520 }
521
522 $this->db->update(
523 'desktop_item',
524 ['type' => [ilDBConstants::T_TEXT, self::NEW_TYPE]],
525 [
526 'item_id' => [ilDBConstants::T_INTEGER, (int) $row['item_id']],
527 'user_id' => [ilDBConstants::T_INTEGER, (int) $row['user_id']],
528 ]
529 );
530 }

References ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\step().

+ Here is the caller graph for this function:

◆ stepLegacy()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::stepLegacy ( )
private

Definition at line 555 of file class.ilObjectGroupRebrandMigration.php.

555 : void
556 {
557 foreach (self::LEGACY_TARGETS as $table => $spec) {
558 if (!$this->legacyTableReady($table, $spec['columns'])) {
559 continue;
560 }
561
562 $row = $this->fetchLegacyOne($table, $spec);
563 if ($row === null) {
564 continue;
565 }
566
567 if ($this->legacyTypeIsInPrimaryKey($spec) && $this->legacyDestinationExists($table, $spec, $row)) {
568 $this->db->manipulate(
569 "DELETE FROM {$table} WHERE {$this->legacySourceWhere($spec, $row)}"
570 );
571 return;
572 }
573
574 $assignments = [];
575 foreach ($spec['columns'] as $column) {
576 if ((string) $row[$column] !== self::OLD_TYPE) {
577 continue;
578 }
579 $assignments[] = "{$column} = {$this->db->quote(self::NEW_TYPE, ilDBConstants::T_TEXT)}";
580 }
581 if ($assignments === []) {
582 return;
583 }
584
585 $this->db->manipulate(
586 "UPDATE {$table} SET " . implode(', ', $assignments) . " WHERE {$this->legacySourceWhere($spec, $row)}"
587 );
588 return;
589 }
590 }

References ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\fetchLegacyOne(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\legacyDestinationExists(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\legacyTableReady(), and ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\legacyTypeIsInPrimaryKey().

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\step().

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

◆ stepObjectData()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::stepObjectData ( )
private

Definition at line 277 of file class.ilObjectGroupRebrandMigration.php.

277 : void
278 {
279 $result = $this->db->queryF(
280 'SELECT obj_id FROM object_data WHERE type = %s LIMIT 1',
282 [self::OLD_TYPE]
283 );
284 $row = $this->db->fetchObject($result);
285 if ($row !== null) {
286 $this->db->update(
287 'object_data',
288 ['type' => [ilDBConstants::T_TEXT, self::NEW_TYPE]],
289 ['obj_id' => [ilDBConstants::T_INTEGER, (int) $row->obj_id]]
290 );
291 return;
292 }
293
294 $typ_result = $this->db->queryF(
295 'SELECT obj_id FROM object_data WHERE type = %s AND title = %s LIMIT 1',
297 ['typ', self::OLD_TYPE]
298 );
299 $typ_row = $this->db->fetchObject($typ_result);
300 if ($typ_row === null) {
301 return;
302 }
303
304 $this->db->update(
305 'object_data',
306 [
307 'title' => [ilDBConstants::T_TEXT, self::NEW_TYPE],
308 'description' => [ilDBConstants::T_TEXT, 'Object Group'],
309 ],
310 ['obj_id' => [ilDBConstants::T_INTEGER, (int) $typ_row->obj_id]]
311 );
312 }

References ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\step().

+ Here is the caller graph for this function:

◆ stepRbac()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::stepRbac ( )
private

Definition at line 333 of file class.ilObjectGroupRebrandMigration.php.

333 : void
334 {
335 $result = $this->db->queryF(
336 'SELECT ops_id FROM rbac_operations WHERE operation = %s LIMIT 1',
338 [$this->rbacCreateOperationOld()]
339 );
340 $row = $this->db->fetchObject($result);
341 if ($row !== null) {
342 $this->db->update(
343 'rbac_operations',
344 [
345 'operation' => [ilDBConstants::T_TEXT, $this->rbacCreateOperationNew()],
346 'description' => [ilDBConstants::T_TEXT, 'Create Object Group'],
347 ],
348 ['ops_id' => [ilDBConstants::T_INTEGER, (int) $row->ops_id]]
349 );
350 return;
351 }
352
353 $template_result = $this->db->queryF(
354 'SELECT rol_id, ops_id, parent FROM rbac_templates WHERE type = %s LIMIT 1',
356 [self::OLD_TYPE]
357 );
358 $template_row = $this->db->fetchObject($template_result);
359 if ($template_row === null) {
360 return;
361 }
362
363 $rol_id = (int) $template_row->rol_id;
364 $ops_id = (int) $template_row->ops_id;
365 $parent = (int) $template_row->parent;
366
367 if ($this->rbacTemplateRowExists($rol_id, $ops_id, $parent, self::NEW_TYPE)) {
368 $this->db->manipulateF(
369 'DELETE FROM rbac_templates WHERE rol_id = %s AND ops_id = %s AND parent = %s AND type = %s',
370 [
375 ],
376 [$rol_id, $ops_id, $parent, self::OLD_TYPE]
377 );
378 return;
379 }
380
381 $this->db->update(
382 'rbac_templates',
383 ['type' => [ilDBConstants::T_TEXT, self::NEW_TYPE]],
384 [
385 'rol_id' => [ilDBConstants::T_INTEGER, $rol_id],
386 'ops_id' => [ilDBConstants::T_INTEGER, $ops_id],
387 'parent' => [ilDBConstants::T_INTEGER, $parent],
388 'type' => [ilDBConstants::T_TEXT, self::OLD_TYPE],
389 ]
390 );
391 }
rbacTemplateRowExists(int $rol_id, int $ops_id, int $parent, string $type)
if(!file_exists('../ilias.ini.php'))

References if, ILIAS\Repository\int(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\rbacCreateOperationNew(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\rbacCreateOperationOld(), ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\rbacTemplateRowExists(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\step().

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

◆ stepSettings()

ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::stepSettings ( )
private

Definition at line 458 of file class.ilObjectGroupRebrandMigration.php.

458 : void
459 {
460 foreach (self::SETTINGS_KEY_MAP as $old_key => $new_key) {
461 $result = $this->db->queryF(
462 'SELECT module, value FROM settings WHERE keyword = %s LIMIT 1',
464 [$old_key]
465 );
466 $row = $this->db->fetchAssoc($result);
467 if ($row === null) {
468 continue;
469 }
470
471 if ($this->settingsKeywordExists($new_key, $row['module'])) {
472 $this->db->manipulateF(
473 'DELETE FROM settings WHERE module = %s AND keyword = %s',
475 [$row['module'], $old_key]
476 );
477 } else {
478 $this->db->manipulateF(
479 'UPDATE settings SET keyword = %s WHERE module = %s AND keyword = %s',
481 [$new_key, $row['module'], $old_key]
482 );
483 }
484 return;
485 }
486 }

References ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\settingsKeywordExists(), and ilDBConstants\T_TEXT.

Referenced by ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration\step().

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

Field Documentation

◆ $db

ilDBInterface ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::$db
protected

Definition at line 206 of file class.ilObjectGroupRebrandMigration.php.

◆ LEGACY_TARGETS

const array ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::LEGACY_TARGETS
private

Definition at line 43 of file class.ilObjectGroupRebrandMigration.php.

◆ LEGACY_TEXT_COLUMNS

const array ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::LEGACY_TEXT_COLUMNS
private
Initial value:
= [
'obj_type',
'type',
'sub_type',
'context_obj_type',
'context_sub_obj_type',
]

Definition at line 198 of file class.ilObjectGroupRebrandMigration.php.

◆ NEW_TYPE

const string ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::NEW_TYPE = 'obgr'
private

◆ OLD_TYPE

const string ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::OLD_TYPE = 'itgr'
private

◆ SETTINGS_KEY_MAP

const array ILIAS\ObjectGroup\Setup\ilObjectGroupRebrandMigration::SETTINGS_KEY_MAP
private
Initial value:
= [
'obj_add_new_pos_itgr' => 'obj_add_new_pos_obgr',
'obj_add_new_pos_grp_itgr' => 'obj_add_new_pos_grp_obgr',
'obj_dis_creation_itgr' => 'obj_dis_creation_obgr',
]

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


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