19 declare(strict_types=1);
29 protected \ilResourceStorageMigrationHelper
$helper;
33 return "Migration of exercise sample solutions to the resource storage service.";
43 return \ilResourceStorageMigrationHelper::getPreconditions();
48 $this->helper = new \ilResourceStorageMigrationHelper(
56 $r = $this->helper->getDatabase()->query(
57 "SELECT id, exc_id, owner FROM exc_assignment JOIN object_data ON exc_id = obj_id WHERE solution_rid IS NULL LIMIT 1;" 59 $d = $this->helper->getDatabase()->fetchObject(
$r);
64 $exec_id = (
int)
$d->exc_id;
65 $assignment_id = (
int)
$d->id;
66 $resource_owner_id = (
int)
$d->owner;
67 $base_path = $this->buildAbsolutPath($exec_id, $assignment_id);
68 $pattern =
'/[^\.].*/m';
70 if (is_dir($base_path)) {
71 $rid = $this->helper->moveFirstFileOfPatternToStorage(
77 $this->helper->getDatabase()->update(
80 'solution_rid' => [
'text', (
string) $rid]
83 'id' => [
'integer', $assignment_id],
84 'exc_id' => [
'integer', $exec_id]
91 $r = $this->helper->getDatabase()->query(
92 "SELECT count(id) AS amount FROM exc_assignment JOIN object_data ON exc_id = obj_id WHERE solution_rid IS NULL" 94 $d = $this->helper->getDatabase()->fetchObject(
$r);
96 return (
int)
$d->amount;
106 ) .
"/feedb_$assignment_id/0";
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...
static createPathFromId(int $a_container_id, string $a_name)
buildAbsolutPath(int $exec_id, int $assignment_id)
ilResourceStorageMigrationHelper $helper
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.
getPreconditions(Environment $environment)
Objectives the migration depend on.
step(Environment $environment)
Run one step of the migration.