Merge branch 'MDL-60375_master' of git://github.com/dmonllao/moodle

This commit is contained in:
Jun Pataleta
2017-10-19 22:03:56 +13:00
4 changed files with 44 additions and 17 deletions
+6 -4
View File
@@ -157,16 +157,18 @@ class dataset_manager {
];
// Delete previous and old (we already checked that previous copies are not recent) evaluation files for this analysable.
$select = " = {$filerecord['itemid']} AND filepath = :filepath";
$fs->delete_area_files_select($filerecord['contextid'], $filerecord['component'], $filerecord['filearea'],
$select, array('filepath' => $filerecord['filepath']));
if ($this->evaluation) {
$select = " = {$filerecord['itemid']} AND filepath = :filepath";
$fs->delete_area_files_select($filerecord['contextid'], $filerecord['component'], $filerecord['filearea'],
$select, array('filepath' => $filerecord['filepath']));
}
// Write all this stuff to a tmp file.
$filepath = make_request_directory() . DIRECTORY_SEPARATOR . $filerecord['filename'];
$fh = fopen($filepath, 'w+');
if (!$fh) {
$this->close_process();
throw new \moodle_exception('errorcannotwritedataset', 'analytics', '', $tmpfilepath);
throw new \moodle_exception('errorcannotwritedataset', 'analytics', '', $filepath);
}
foreach ($data as $line) {
fputcsv($fh, $line);
+1 -1
View File
@@ -514,7 +514,7 @@ abstract class base {
}
}
if (!empty($target)) {
if (!empty($includetarget)) {
$filearea = \core_analytics\dataset_manager::LABELLED_FILEAREA;
} else {
$filearea = \core_analytics\dataset_manager::UNLABELLED_FILEAREA;