19declare(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 $db = $this->helper->getDatabase();
58 $r = $this->helper->getDatabase()->query(
59 "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;"
61 $d = $this->helper->getDatabase()->fetchObject($r);
62 $exec_id = (
int)
$d->exc_id;
63 $assignment_id = (
int)
$d->id;
64 $resource_owner_id = (
int)
$d->owner;
67 if (is_dir($base_path)) {
68 $collection_id = $this->helper->moveFilesOfPathToCollection(
73 $collection = $this->helper->getCollectionBuilder()->new($resource_owner_id);
74 if ($this->helper->getCollectionBuilder()->store($collection)) {
75 $collection_id = $collection->getIdentification()->serialize();
77 throw new ilException(
"Could not build collection");
80 $this->helper->getDatabase()->update(
83 'feedback_rcid' => [
'text', $collection_id]
86 'ass_id' => [
'integer', $assignment_id],
94 $r = $this->helper->getDatabase()->query(
95 "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 = ''"
97 $d = $this->helper->getDatabase()->fetchObject($r);
99 return (
int)
$d->amount;
109 ) .
"/feedb_$assignment_id/$user_id";
Class ResourceCollection.
Base class for ILIAS Exception handling.
getDefaultAmountOfStepsPerRun()
Tell the default amount of steps to be executed for one run of the migration.
getRemainingAmountOfSteps()
Count up how many "things" need to be migrated.
getPreconditions(Environment $environment)
Objectives the migration depend on.
step(Environment $environment)
Run one step of the migration.
buildAbsolutPath(int $exec_id, int $assignment_id, int $user_id)
prepare(Environment $environment)
Prepare the migration by means of some environment.
ilResourceStorageMigrationHelper $helper
static createPathFromId(int $a_container_id, string $a_name)
An environment holds resources to be used in the setup process.
A migration is a potentially long lasting operation that can be broken into discrete steps.