ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LSOMigratePageIdsIntro Class Reference
+ Inheritance diagram for LSOMigratePageIdsIntro:
+ Collaboration diagram for LSOMigratePageIdsIntro:

Public Member Functions

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

Private Attributes

const DEFAULT_AMOUNT_OF_STEPS = 1000
 
const QUERY
 
ilDBInterface $db
 

Detailed Description

Definition at line 24 of file class.LSOMigratePageIdsIntro.php.

Member Function Documentation

◆ getDefaultAmountOfStepsPerRun()

LSOMigratePageIdsIntro::getDefaultAmountOfStepsPerRun ( )

Definition at line 39 of file class.LSOMigratePageIdsIntro.php.

39 : int
40 {
42 }

References DEFAULT_AMOUNT_OF_STEPS.

◆ getLabel()

LSOMigratePageIdsIntro::getLabel ( )

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

34 : string
35 {
36 return "Update IDs of intro pages";
37 }

◆ getPreconditions()

LSOMigratePageIdsIntro::getPreconditions ( Environment  $environment)

Definition at line 44 of file class.LSOMigratePageIdsIntro.php.

◆ getRemainingAmountOfSteps()

LSOMigratePageIdsIntro::getRemainingAmountOfSteps ( )

Definition at line 71 of file class.LSOMigratePageIdsIntro.php.

71 : int
72 {
73 $result = $this->db->query(self::QUERY);
74 $row = $this->db->fetchAssoc($result);
75
76 return (int) $row['cnt'];
77 }

◆ prepare()

LSOMigratePageIdsIntro::prepare ( Environment  $environment)

Definition at line 51 of file class.LSOMigratePageIdsIntro.php.

51 : void
52 {
53 $this->db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
54 }
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.

References ILIAS\Setup\Environment\getResource().

+ Here is the call graph for this function:

◆ step()

LSOMigratePageIdsIntro::step ( Environment  $environment)
Exceptions
Exception

Definition at line 59 of file class.LSOMigratePageIdsIntro.php.

59 : void
60 {
61 $result = $this->db->query(self::QUERY . ' LIMIT 1');
62 $row = $this->db->fetchAssoc($result);
63 $query = 'UPDATE page_object' . PHP_EOL
64 . "SET page_id = parent_id, parent_type = 'lsoi'" . PHP_EOL
65 . "WHERE page_id = " . $row['page_id'] . PHP_EOL
66 . "AND parent_id = " . $row['parent_id'] . PHP_EOL
67 . "AND parent_type = " . $this->db->quote($row['parent_type'], 'text');
68 $this->db->manipulate($query);
69 }

Field Documentation

◆ $db

ilDBInterface LSOMigratePageIdsIntro::$db
private

Definition at line 32 of file class.LSOMigratePageIdsIntro.php.

◆ DEFAULT_AMOUNT_OF_STEPS

const LSOMigratePageIdsIntro::DEFAULT_AMOUNT_OF_STEPS = 1000
private

Definition at line 26 of file class.LSOMigratePageIdsIntro.php.

Referenced by getDefaultAmountOfStepsPerRun().

◆ QUERY

const LSOMigratePageIdsIntro::QUERY
private
Initial value:
= "SELECT page_id, parent_id, parent_type, count(page_id) AS cnt" . PHP_EOL
. "FROM page_object" . PHP_EOL
. "WHERE page_id = (parent_id * -1)" . PHP_EOL
. "AND parent_type = 'cont'"

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


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