2023-09-05 15:21:01 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2024-03-07 17:47:54 +01:00
|
|
|
* Mises à jour suivant les versions de ZwiiCampus
|
2023-09-05 15:21:01 +02:00
|
|
|
*/
|
2024-03-07 17:47:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
$this->getData(['core', 'dataVersion']) < 1700
|
|
|
|
) {
|
|
|
|
// Supprime la variable path des profils, seul l'accès à l'espace et autorisé.
|
|
|
|
foreach (['1', '2'] as $group) {
|
2024-04-03 16:59:04 +02:00
|
|
|
foreach (array_keys($this->getData(['profil', $group])) as $profil) {
|
2024-03-07 17:47:54 +01:00
|
|
|
if (is_null($this->getData(['profil', $group, $profil, 'folder', 'path'])) === false) {
|
|
|
|
$path = $this->getData(['profil', $group, $profil, 'folder', 'path']);
|
|
|
|
$this->setData(['profil', $group, $profil, 'folder', 'homePath', $path]);
|
|
|
|
$this->setData(['profil', $group, $profil, 'folder', 'coursePath', $path]);
|
|
|
|
$this->deleteData(['profil', $group, $profil, 'folder', 'path']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->setData(['core', 'dataVersion', 1700]);
|
2024-04-03 16:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Déplacement des
|
|
|
|
if (
|
|
|
|
$this->getData(['core', 'dataVersion']) < 1800
|
|
|
|
) {
|
|
|
|
|
|
|
|
// Déplace les incriptions dans les cours
|
|
|
|
if (file_exists(self::DATA_DIR . 'enrolment.json')) {
|
|
|
|
$old_enrolment = json_decode(file_get_contents(self::DATA_DIR . 'enrolment.json'), true);
|
|
|
|
$old_enrolment = $old_enrolment['enrolment'];
|
|
|
|
foreach ($this->getData(['course']) as $courseId => $courseValues) {
|
|
|
|
if (array_key_exists($courseId, $old_enrolment)) {
|
|
|
|
file_put_contents(self::DATA_DIR . $courseId . '/enrolment.json', json_encode(['enrolment' => [$courseId => $old_enrolment[$courseId]]], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), LOCK_EX);
|
|
|
|
} else {
|
|
|
|
// Création d'une structure vide
|
|
|
|
file_put_contents(self::DATA_DIR . $courseId . '/enrolment.json', json_encode(['enrolment' => [$courseId => []]], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), LOCK_EX);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
unlink(self::DATA_DIR . 'enrolment.json');
|
|
|
|
$this->setData(['core', 'dataVersion', 1800]);
|
|
|
|
}
|
|
|
|
$t = $this->getEnrolment(['65d749713a217']);
|
|
|
|
var_dump($t);
|
|
|
|
dei();
|