ILIAS  release_8 Revision v8.24
class.ilBibliographicStorageMigration.php
Go to the documentation of this file.
1<?php
2
20use ILIAS\Setup;
22
28{
30
34 public function getLabel(): string
35 {
36 return "Migration of Bibliographies to the Resource Storage Service.";
37 }
38
43 {
44 return 10000;
45 }
46
50 public function getPreconditions(Environment $environment): array
51 {
53 }
54
58 public function prepare(Environment $environment): void
59 {
60 $this->helper = new ilResourceStorageMigrationHelper(
62 $environment
63 );
64 }
65
69 public function step(Environment $environment): void
70 {
71 $r = $this->helper->getDatabase()->query("SELECT * FROM il_bibl_data
72 JOIN object_data ON object_data.obj_id = il_bibl_data.id
73 WHERE rid IS NULL LIMIT 1");
74 $d = $this->helper->getDatabase()->fetchObject($r);
75
76 $file_path = $this->helper->getClientDataDir() . '/' . ilBibliographicSetupAgent::COMPONENT_DIR . '/' . $d->id . '/' . $d->filename;
77 $identification = $this->helper->movePathToStorage($file_path, (int) $d->owner);
78 if ($identification === null) {
79 $identification = 'failed';
80 } else {
81 $identification = $identification->serialize();
82 }
83
84 $this->helper->getDatabase()->manipulateF(
85 'UPDATE `il_bibl_data` SET `rid` = %s WHERE `id` = %s;',
86 ['text', 'integer'],
87 [
88 $identification,
89 $d->id,
90 ]
91 );
92 }
93
97 public function getRemainingAmountOfSteps(): int
98 {
99 $r = $this->helper->getDatabase()->query("SELECT COUNT(*) AS amount FROM il_bibl_data WHERE rid IS NULL OR rid = ''");
100 $d = $this->helper->getDatabase()->fetchObject($r);
101
102 return (int) $d->amount;
103 }
104}
Class ilBibliographicStorageMigration.
prepare(Environment $environment)
@inheritDoc
getPreconditions(Environment $environment)
@inheritDoc
Class ilObjBibliographicStakeholder.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
A migration is a potentially long lasting operation that can be broken into discrete steps.
Definition: Migration.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...