28 return 'File Upload Question Migration';
43 $this->helper = new \ilResourceStorageMigrationHelper(
51 $db = $this->helper->getDatabase();
54 tst_solutions.solution_id AS solution_id,
55 tst_active.user_fi AS user_id,
56 tst_solutions.question_fi AS question_id,
57 tst_solutions.active_fi AS active_id,
58 tst_active.test_fi AS test_id,
59 tst_solutions.value1 AS filename,
60 tst_solutions.value2 AS revision_name
62 INNER JOIN qpl_qst_fileupload ON qpl_qst_fileupload.question_fi = tst_solutions.question_fi
63 INNER JOIN tst_active ON tst_active.active_id = tst_solutions.active_fi
64 WHERE tst_solutions.value2 != "rid";'
71 $active_id = (
int)
$res[
'active_id'];
72 $test_id = (
int)
$res[
'test_id'];
73 $question_id = (
int)
$res[
'question_id'];
75 $revision_name =
$res[
'revision_name'];
76 $solution_id = (
int)
$res[
'solution_id'];
88 if (file_exists(
$path)) {
89 $rid = $this->helper->movePathToStorage(
93 static function () use ($revision_name):
string {
94 return $revision_name;
99 $rid = $rid->serialize();
106 'value1' => [
'string', $rid],
107 'value2' => [
'string',
'rid']
110 'solution_id' => [
'integer', $solution_id]
117 $database = $this->helper->getDatabase();
118 $res = $database->query(
119 "SELECT COUNT(*) as count
121 INNER JOIN qpl_qst_fileupload ON qpl_qst_fileupload.question_fi = tst_solutions.question_fi
122 INNER JOIN tst_active ON tst_active.active_id = tst_solutions.active_fi
123 WHERE tst_solutions.value2 != 'rid';"
126 return (
int) $database->fetchAssoc(
$res)[
'count'];
Class ilResourceStorageMigrationHelper.
static getPreconditions()
getRemainingAmountOfSteps()
Count up how many "things" need to be migrated.
ilResourceStorageMigrationHelper $helper
step(Environment $environment)
Run one step of the migration.
getPreconditions(Environment $environment)
Objectives the migration depend on.
buildAbsolutPath(int $test_id, int $active_id, int $question_id, string $filename)
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.
return['delivery_method'=> 'php',]
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.
A migration is a potentially long lasting operation that can be broken into discrete steps.