19 declare(strict_types=1);
26 protected \ilResourceStorageMigrationHelper
$helper;
30 return "Migration of exercise submission to the resource storage service.";
40 return \ilResourceStorageMigrationHelper::getPreconditions();
45 $this->helper = new \ilResourceStorageMigrationHelper(
53 $db = $this->helper->getDatabase();
55 "SELECT er.returned_id, er.obj_id, er.ass_id, od.owner, er.user_id, er.team_id FROM exc_returned er JOIN object_data od ON er.obj_id = od.obj_id WHERE er.rid IS NULL LIMIT 1;" 57 $d = $this->helper->getDatabase()->fetchObject(
$r);
58 $exec_id = (
int)
$d->obj_id;
59 $assignment_id = (
int)
$d->ass_id;
60 $returned_id = (
int)
$d->returned_id;
61 $resource_owner_id = (
int)
$d->owner;
66 $pattern =
'/[^\.].*/m';
68 if (is_dir($base_path)) {
69 $rid = $this->helper->moveFirstFileOfPatternToStorage(
75 $this->helper->getDatabase()->update(
78 'rid' => [
'text', (
string) $rid]
81 'ass_id' => [
'integer', $assignment_id],
82 'returned_id' => [
'integer', $returned_id]
89 $r = $this->helper->getDatabase()->query(
90 "SELECT count(er.returned_id) as amount FROM exc_returned er JOIN object_data od ON er.obj_id = od.obj_id WHERE er.rid IS NULL;" 92 $d = $this->helper->getDatabase()->fetchObject(
$r);
94 return (
int)
$d->amount;
105 ) .
"/subm_$assignment_id/" .
$user_id;
ilResourceStorageMigrationHelper $helper
A migration is a potentially long lasting operation that can be broken into discrete steps...
buildAbsolutPath(int $exec_id, int $assignment_id, int $user_id)
getRemainingAmountOfSteps()
Count up how many "things" need to be migrated.
static createPathFromId(int $a_container_id, string $a_name)
getPreconditions(Environment $environment)
Objectives the migration depend on.
An environment holds resources to be used in the setup process.
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.
prepare(Environment $environment)
Prepare the migration by means of some environment.