19 declare(strict_types=1);
30 protected \ilResourceStorageMigrationHelper
$helper;
34 return "Migration of tutor 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, st.usr_id FROM exc_assignment ass JOIN object_data ob ON ass.exc_id = ob.obj_id JOIN exc_mem_ass_status st ON st.ass_id = ass.id WHERE st.feedback_rcid IS NULL OR st.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 $user_id = (
int)
$d->usr_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 'ass_id' => [
'integer', $assignment_id],
90 'usr_id' => [
'integer', $user_id]
97 $r = $this->helper->getDatabase()->query(
98 "SELECT count(*) AS amount FROM exc_assignment ass JOIN object_data ob ON ass.exc_id = ob.obj_id JOIN exc_mem_ass_status st ON st.ass_id = ass.id WHERE st.feedback_rcid IS NULL OR st.feedback_rcid = ''" 100 $d = $this->helper->getDatabase()->fetchObject(
$r);
102 return (
int)
$d->amount;
105 protected function buildAbsolutPath(
int $exec_id,
int $assignment_id,
int $user_id): string
112 ) .
"/feedb_$assignment_id/$user_id";
step(Environment $environment)
Run one step of the migration.
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...
ilResourceStorageMigrationHelper $helper
buildAbsolutPath(int $exec_id, int $assignment_id, int $user_id)
getRemainingAmountOfSteps()
Count up how many "things" need to be migrated.
getPreconditions(Environment $environment)
Objectives the migration depend on.
static createPathFromId(int $a_container_id, string $a_name)
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.