ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\AdvancedMetaData\Setup\SelectOptionsMigration Class Reference
+ Inheritance diagram for ILIAS\AdvancedMetaData\Setup\SelectOptionsMigration:
+ Collaboration diagram for ILIAS\AdvancedMetaData\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...
 
 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\AdvancedMetaData\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.

36 : int
37 {
39 }

References ILIAS\Setup\Migration\INFINITE.

◆ getLabel()

ILIAS\AdvancedMetaData\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\AdvancedMetaData\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\AdvancedMetaData\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.

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:69

References $res.

◆ prepare()

ILIAS\AdvancedMetaData\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.

50 : void
51 {
52 $this->db = $environment->getResource(Environment::RESOURCE_DATABASE);
53 }

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

+ Here is the call graph for this function:

◆ step()

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

Run one step of the migration.

Implements ILIAS\Setup\Migration.

Definition at line 55 of file SelectOptionsMigration.php.

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

References $res.

Field Documentation

◆ $db

ilDBInterface ILIAS\AdvancedMetaData\Setup\SelectOptionsMigration::$db
protected

Definition at line 29 of file SelectOptionsMigration.php.


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