ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Setup\SelectOptionsMigration Class Reference
+ Inheritance diagram for ILIAS\Setup\SelectOptionsMigration:
+ Collaboration diagram for ILIAS\Setup\SelectOptionsMigration:

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...
 

Protected Attributes

ilDBInterface $db
 

Additional Inherited Members

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

Detailed Description

Definition at line 27 of file SelectOptionsMigration.php.

Member Function Documentation

◆ getDefaultAmountOfStepsPerRun()

ILIAS\Setup\SelectOptionsMigration::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 36 of file SelectOptionsMigration.php.

References ILIAS\Setup\Migration\INFINITE.

36  : int
37  {
38  return Migration::INFINITE;
39  }

◆ getLabel()

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

Implements ILIAS\Setup\Migration.

Definition at line 31 of file SelectOptionsMigration.php.

31  : string
32  {
33  return "Grants each select option a permanent ID.";
34  }

◆ getPreconditions()

ILIAS\Setup\SelectOptionsMigration::getPreconditions ( Environment  $environment)

Objectives the migration depend on.

Exceptions
UnachievableExceptionif the objective is not achievable
Returns
Objective[]

Implements ILIAS\Setup\Migration.

Definition at line 41 of file SelectOptionsMigration.php.

41  : array
42  {
43  return [
44  new \ilIniFilesLoadedObjective(),
45  new \ilDatabaseInitializedObjective(),
46  new \ilDatabaseUpdatedObjective(),
47  ];
48  }

◆ getRemainingAmountOfSteps()

ILIAS\Setup\SelectOptionsMigration::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 62 of file SelectOptionsMigration.php.

References $res.

62  : int
63  {
64  $res = $this->db->query(
65  'SELECT COUNT(*) AS count FROM adv_mdf_enum WHERE position IS NULL'
66  );
67 
68  $row = $this->db->fetchAssoc($res);
69  return (int) $row['count'];
70  }
$res
Definition: ltiservices.php:66

◆ prepare()

ILIAS\Setup\SelectOptionsMigration::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 50 of file SelectOptionsMigration.php.

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

50  : void
51  {
52  $this->db = $environment->getResource(Environment::RESOURCE_DATABASE);
53  }
+ Here is the call graph for this function:

◆ step()

ILIAS\Setup\SelectOptionsMigration::step ( Environment  $environment)

Run one step of the migration.

Implements ILIAS\Setup\Migration.

Definition at line 55 of file SelectOptionsMigration.php.

References $res.

55  : void
56  {
57  $res = $this->db->manipulate(
58  'UPDATE adv_mdf_enum SET position = idx WHERE position IS NULL LIMIT 1'
59  );
60  }
$res
Definition: ltiservices.php:66

Field Documentation

◆ $db

ilDBInterface ILIAS\Setup\SelectOptionsMigration::$db
protected

Definition at line 29 of file SelectOptionsMigration.php.


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