ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
PRGUpdateRestartedSourceMigration Class Reference
+ Inheritance diagram for PRGUpdateRestartedSourceMigration:
+ Collaboration diagram for PRGUpdateRestartedSourceMigration:

Public Member Functions

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

Private Attributes

const DEFAULT_AMOUNT_OF_STEPS = 1
 
ilDBInterface $db
 
mixed $io
 

Detailed Description

Definition at line 25 of file class.PRGUpdateRestartedSourceMigration.php.

Member Function Documentation

◆ getDefaultAmountOfStepsPerRun()

PRGUpdateRestartedSourceMigration::getDefaultAmountOfStepsPerRun ( )

Definition at line 40 of file class.PRGUpdateRestartedSourceMigration.php.

40  : int
41  {
42  return self::DEFAULT_AMOUNT_OF_STEPS;
43  }

◆ getLabel()

PRGUpdateRestartedSourceMigration::getLabel ( )

Definition at line 35 of file class.PRGUpdateRestartedSourceMigration.php.

35  : string
36  {
37  return "Update 'Assigned By' for restarted assignments";
38  }

◆ getPreconditions()

PRGUpdateRestartedSourceMigration::getPreconditions ( Environment  $environment)

Definition at line 45 of file class.PRGUpdateRestartedSourceMigration.php.

45  : array
46  {
47  return [
50  ];
51  }

◆ getRemainingAmountOfSteps()

PRGUpdateRestartedSourceMigration::getRemainingAmountOfSteps ( )

Definition at line 69 of file class.PRGUpdateRestartedSourceMigration.php.

References ilPRGAssignment\AUTO_ASSIGNED_BY_RESTART.

69  : int
70  {
71  $query = "SELECT count(restarted_assignment_id) AS cnt FROM prg_usr_assignments" . PHP_EOL
72  . " WHERE restarted_assignment_id != -1" . PHP_EOL
73  . "AND restarted_assignment_id NOT IN (SELECT id FROM prg_usr_assignments WHERE last_change_by = " . ilPRGAssignment::AUTO_ASSIGNED_BY_RESTART . ");";
74 
75  $result = $this->db->query($query);
76  $row = $this->db->fetchAssoc($result);
77  return (int) $row['cnt'] > 0 ? 1 : 0;
78  }

◆ prepare()

PRGUpdateRestartedSourceMigration::prepare ( Environment  $environment)

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

References ILIAS\Setup\Environment\getResource().

53  : void
54  {
55  $this->db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
56  }
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:

◆ step()

PRGUpdateRestartedSourceMigration::step ( Environment  $environment)
Exceptions
Exception

Definition at line 61 of file class.PRGUpdateRestartedSourceMigration.php.

References ilPRGAssignment\AUTO_ASSIGNED_BY_RESTART.

61  : void
62  {
63  $query = "UPDATE prg_usr_assignments SET last_change_by = " . ilPRGAssignment::AUTO_ASSIGNED_BY_RESTART . PHP_EOL
64  . "WHERE id in (SELECT restarted_assignment_id FROM prg_usr_assignments WHERE restarted_assignment_id != -1)" . PHP_EOL
65  . "AND restarted_assignment_id NOT IN (SELECT id FROM prg_usr_assignments WHERE last_change_by = " . ilPRGAssignment::AUTO_ASSIGNED_BY_RESTART . ")";
66  $this->db->manipulate($query);
67  }

Field Documentation

◆ $db

ilDBInterface PRGUpdateRestartedSourceMigration::$db
private

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

◆ $io

mixed PRGUpdateRestartedSourceMigration::$io
private

Definition at line 33 of file class.PRGUpdateRestartedSourceMigration.php.

◆ DEFAULT_AMOUNT_OF_STEPS

const PRGUpdateRestartedSourceMigration::DEFAULT_AMOUNT_OF_STEPS = 1
private

Definition at line 27 of file class.PRGUpdateRestartedSourceMigration.php.


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