Migration for bug fix 19795.
17 $result = $ilDB->query(
"SELECT exc_assignment.exc_id, exc_assignment.peer_crit_cat, exc_assignment.id, exc_assignment_peer.giver_id, exc_assignment_peer.peer_id".
18 " FROM exc_assignment_peer, exc_assignment".
19 " WHERE exc_assignment.id = exc_assignment_peer.ass_id".
20 " AND (exc_assignment.peer_file = 1 OR exc_assignment.peer_crit_cat > 0)".
21 " AND exc_assignment_peer.tstamp IS NOT null" 26 include_once(
"./Services/Migration/DBUpdate_5069/classes/class.ilFSStorageExercise5069.php");
30 if(
$row[
'peer_crit_cat'])
34 $res_crit = $ilDB->query($q =
"SELECT id FROM exc_crit ".
35 " WHERE parent = ".$ilDB->quote(
$row[
'peer_crit_cat'],
"integer").
36 " AND type = ".$ilDB->quote(
'file',
'text')
39 while($row_crit = $ilDB->fetchAssoc($res_crit))
41 $original_path = $storage->getPeerReviewUploadPath(
$row[
'peer_id'],
$row[
'giver_id'], $row_crit[
'id']);
43 $path_peaces = explode(
'/', rtrim($original_path,
'/'));
44 array_pop($path_peaces);
45 $previous_dir_path =
"";
46 foreach ($path_peaces as $piece)
48 $previous_dir_path .= $piece.
"/";
50 $dir_content = array_diff(scandir($previous_dir_path),
array(
'.',
'..'));
53 foreach($dir_content as $content)
55 if(is_dir($previous_dir_path.$content))
58 if($content ==
$row[
'giver_id'].$row_crit[
'id'])
60 if(!is_dir($previous_dir_path.$row[
'giver_id']))
62 mkdir($previous_dir_path.$row[
'giver_id']);
66 if(!is_dir($previous_dir_path.$row[
'giver_id'].
"/".$row_crit[
'id']))
68 mkdir($previous_dir_path.$row[
'giver_id'].
"/".$row_crit[
'id']);
73 $old = substr($original_path, 0, strlen($original_path) - 1);
74 $new = $previous_dir_path.$row[
'giver_id'].
"/".$row_crit[
'id'];
88 $original_path = $storage->getPeerReviewUploadPath(
$row[
'peer_id'],
$row[
'giver_id'],
$row[
'peer_crit_cat']);
90 $path_peaces = explode(
'/', rtrim($original_path,
'/'));
91 array_pop($path_peaces);
92 $previous_dir_path =
"";
93 foreach ($path_peaces as $piece)
95 $previous_dir_path .= $piece.
"/";
98 $dir_content = array_diff(scandir($previous_dir_path),
array(
'.',
'..'));
100 foreach($dir_content as $content)
102 if(!is_dir($previous_dir_path.$content))
104 if (substr($content, 0, strlen(
$row[
'giver_id'])) ===
$row[
'giver_id'])
106 $new_filename = substr($content, strlen(
$row[
'giver_id']));
107 copy($previous_dir_path.$content, $original_path.
"/".$new_filename);
Create styles array
The data for the language used.