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'];
getRemainingAmountOfSteps()
Count up how many "things" need to be migrated.
A migration is a potentially long lasting operation that can be broken into discrete steps...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
prepare(Environment $environment)
Prepare the migration by means of some environment.
buildAbsolutPath(int $test_id, int $active_id, int $question_id, string $filename)
ilResourceStorageMigrationHelper $helper
getPreconditions(Environment $environment)
Objectives the migration depend on.
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.
An environment holds resources to be used in the setup process.
static getPreconditions()