◆ getDefaultAmountOfStepsPerRun()
| IndAssStorageMigration::getDefaultAmountOfStepsPerRun |
( |
| ) |
|
◆ getLabel()
| IndAssStorageMigration::getLabel |
( |
| ) |
|
◆ getPreconditions()
| IndAssStorageMigration::getPreconditions |
( |
Environment |
$environment | ) |
|
◆ getRemainingAmountOfSteps()
| IndAssStorageMigration::getRemainingAmountOfSteps |
( |
| ) |
|
Definition at line 124 of file class.IndAssStorageMigration.php.
126 $query =
"SELECT COUNT(*) AS amount FROM iass_members WHERE file_name LIKE '%.%';";
127 $result = $this->db->query($query);
128 $row = $this->db->fetchAssoc($result);
129 return (
int) $row[
'amount'];
◆ prepare()
| IndAssStorageMigration::prepare |
( |
Environment |
$environment | ) |
|
◆ step()
| IndAssStorageMigration::step |
( |
Environment |
$environment | ) |
|
- Exceptions
-
Definition at line 85 of file class.IndAssStorageMigration.php.
References $dic, $filename, $GLOBALS, ilIndividualAssessmentFileStorage\getInstance(), and ILIAS\Repository\int().
89 $query =
"SELECT obj_id, usr_id, file_name FROM iass_members WHERE file_name LIKE '%.%' LIMIT 1;";
90 $result = $this->db->query($query);
91 $row = $this->db->fetchAssoc($result);
93 $obj_id = (
int) $row[
'obj_id'];
94 $usr_id = (
int) $row[
'usr_id'];
96 $fs_storage->setUserId($usr_id);
99 $filename_cb =
static fn(
string $fn) =>
$filename;
100 $filepath = $fs_storage->getAbsolutePath() .
'/' .
$filename;
102 if (! file_exists($filepath)) {
103 $dir = scandir($fs_storage->getAbsolutePath());
104 if ($dir ===
false) {
105 throw new \Exception(
'cannot scan directory:' . $fs_storage->getAbsolutePath());
107 $files = array_diff($dir, [
'.',
'..']);
108 $filepath = $fs_storage->getAbsolutePath() .
'/' . current($files);
109 if (file_exists($filepath) ===
false || count($files) < 1) {
110 throw new \Exception(
'no file in:' . $filepath);
114 $resource_id = $this->helper->movePathToStorage($filepath, 6, $filename_cb);
115 if (! $resource_id) {
116 throw new \Exception(
'not stored:' . $filepath);
119 $identifier = $resource_id->serialize();
120 $query =
"UPDATE iass_members SET file_name = '$identifier' WHERE obj_id = $obj_id AND usr_id = $usr_id";
121 $this->db->manipulate($query);
static getInstance(int $container_id=0)
◆ $db
◆ $dic
| ILIAS DI Container IndAssStorageMigration::$dic |
|
private |
◆ $helper
◆ $io
| mixed IndAssStorageMigration::$io |
|
private |
◆ DEFAULT_AMOUNT_OF_STEPS
| const IndAssStorageMigration::DEFAULT_AMOUNT_OF_STEPS = 200 |
|
private |
The documentation for this class was generated from the following file: