ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilBookingManagerBookingInfoMigration Class Reference
+ Inheritance diagram for ilBookingManagerBookingInfoMigration:
+ Collaboration diagram for ilBookingManagerBookingInfoMigration:

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 Member Functions

 buildAbsolutPath (int $pool_id, int $booking_object_id)
 

Protected Attributes

ilResourceStorageMigrationHelper $helper
 

Additional Inherited Members

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

Detailed Description

Member Function Documentation

◆ buildAbsolutPath()

ilBookingManagerBookingInfoMigration::buildAbsolutPath ( int  $pool_id,
int  $booking_object_id 
)
protected

Definition at line 96 of file class.ilBookingManagerBookingInfoMigration.php.

References CLIENT_WEB_DIR, and ilFileSystemAbstractionStorage\createPathFromId().

96  : string
97  {
98  return CLIENT_WEB_DIR
99  . '/ilBookingManager/'
101  $booking_object_id,
102  "book"
103  ) . "/post";
104  }
static createPathFromId(int $a_container_id, string $a_name)
const CLIENT_WEB_DIR
Definition: constants.php:47
+ Here is the call graph for this function:

◆ getDefaultAmountOfStepsPerRun()

ilBookingManagerBookingInfoMigration::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 class.ilBookingManagerBookingInfoMigration.php.

36  : int
37  {
38  return 1000;
39  }

◆ getLabel()

ilBookingManagerBookingInfoMigration::getLabel ( )
Returns
string - a meaningful and concise description for your migration.

Implements ILIAS\Setup\Migration.

Definition at line 31 of file class.ilBookingManagerBookingInfoMigration.php.

31  : string
32  {
33  return "Migration of post booking info files to the resource storage service.";
34  }

◆ getPreconditions()

ilBookingManagerBookingInfoMigration::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 class.ilBookingManagerBookingInfoMigration.php.

41  : array
42  {
43  return \ilResourceStorageMigrationHelper::getPreconditions();
44  }

◆ getRemainingAmountOfSteps()

ilBookingManagerBookingInfoMigration::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 86 of file class.ilBookingManagerBookingInfoMigration.php.

References Vendor\Package\$d, and $r.

86  : int
87  {
88  $r = $this->helper->getDatabase()->query(
89  "SELECT count(booking_object_id) amount FROM booking_object JOIN object_data ON pool_id = obj_id WHERE book_info_rid IS NULL"
90  );
91  $d = $this->helper->getDatabase()->fetchObject($r);
92 
93  return (int) $d->amount;
94  }
$r

◆ prepare()

ilBookingManagerBookingInfoMigration::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 46 of file class.ilBookingManagerBookingInfoMigration.php.

46  : void
47  {
48  $this->helper = new \ilResourceStorageMigrationHelper(
50  $environment
51  );
52  }

◆ step()

ilBookingManagerBookingInfoMigration::step ( Environment  $environment)

Run one step of the migration.

Implements ILIAS\Setup\Migration.

Definition at line 54 of file class.ilBookingManagerBookingInfoMigration.php.

References Vendor\Package\$d, $r, and ILIAS\Repository\int().

54  : void
55  {
56  $db = $this->helper->getDatabase();
57  $r = $this->helper->getDatabase()->query(
58  "SELECT booking_object_id, pool_id, owner FROM booking_object JOIN object_data ON pool_id = obj_id WHERE book_info_rid IS NULL LIMIT 1;"
59  );
60  $d = $this->helper->getDatabase()->fetchObject($r);
61  $pool_id = (int) $d->pool_id;
62  $booking_object_id = (int) $d->booking_object_id;
63  $resource_owner_id = (int) $d->owner;
64  $base_path = $this->buildAbsolutPath($pool_id, $booking_object_id);
65  $pattern = '/[^\.].*/m';
66  $rid = "";
67  if (is_dir($base_path)) {
68  $rid = $this->helper->moveFirstFileOfPatternToStorage(
69  $base_path,
70  $pattern,
71  $resource_owner_id
72  );
73  }
74  $this->helper->getDatabase()->update(
75  'booking_object',
76  [
77  'book_info_rid' => ['text', (string) $rid]
78  ],
79  [
80  'booking_object_id' => ['integer', $booking_object_id],
81  'pool_id' => ['integer', $pool_id]
82  ]
83  );
84  }
$r
+ Here is the call graph for this function:

Field Documentation

◆ $helper

ilResourceStorageMigrationHelper ilBookingManagerBookingInfoMigration::$helper
protected

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