19 declare(strict_types=1);
30 protected \ilResourceStorageMigrationHelper
$helper;
34 return "Migration of tutor team feedback files to the resource storage service.";
44 return \ilResourceStorageMigrationHelper::getPreconditions();
49 $this->helper = new \ilResourceStorageMigrationHelper(
57 $r = $this->helper->getDatabase()->query(
58 "SELECT ass.id, ass.exc_id, ob.owner, te.id team_id FROM exc_assignment ass JOIN object_data ob ON ass.exc_id = ob.obj_id JOIN il_exc_team te ON te.ass_id = ass.id JOIN exc_team_data td ON te.id = td.id WHERE td.feedback_rcid IS NULL OR td.feedback_rcid = '' LIMIT 1;" 60 $d = $this->helper->getDatabase()->fetchObject(
$r);
65 $exec_id = (
int)
$d->exc_id;
66 $assignment_id = (
int)
$d->id;
67 $resource_owner_id = (
int)
$d->owner;
68 $team_id = (
int)
$d->team_id;
70 if (is_dir($base_path)) {
71 $collection_id = $this->helper->moveFilesOfPathToCollection(
76 $collection = $this->helper->getCollectionBuilder()->new($resource_owner_id);
77 if ($this->helper->getCollectionBuilder()->store($collection)) {
78 $collection_id = $collection->getIdentification()->serialize();
80 throw new ilException(
"Could not build collection");
83 $this->helper->getDatabase()->update(
86 'feedback_rcid' => [
'text', $collection_id]
89 'id' => [
'integer', $team_id]
96 $r = $this->helper->getDatabase()->query(
97 "SELECT count(*) AS amount FROM exc_assignment ass JOIN object_data ob ON ass.exc_id = ob.obj_id JOIN il_exc_team te ON te.ass_id = ass.id JOIN exc_team_data td ON te.id = td.id WHERE td.feedback_rcid IS NULL OR td.feedback_rcid = ''" 99 $d = $this->helper->getDatabase()->fetchObject(
$r);
101 return (
int)
$d->amount;
104 protected function buildAbsolutPath(
int $exec_id,
int $assignment_id,
int $user_id): string
111 ) .
"/feedb_$assignment_id/$user_id";
getPreconditions(Environment $environment)
Objectives the migration depend on.
getDefaultAmountOfStepsPerRun()
Tell the default amount of steps to be executed for one run of the migration.
A migration is a potentially long lasting operation that can be broken into discrete steps...
step(Environment $environment)
Run one step of the migration.
ilResourceStorageMigrationHelper $helper
static createPathFromId(int $a_container_id, string $a_name)
buildAbsolutPath(int $exec_id, int $assignment_id, int $user_id)
getRemainingAmountOfSteps()
Count up how many "things" need to be migrated.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An environment holds resources to be used in the setup process.
prepare(Environment $environment)
Prepare the migration by means of some environment.