diff --git a/lib.php b/lib.php index e2a1ab0..6c3727c 100644 --- a/lib.php +++ b/lib.php @@ -48,7 +48,6 @@ function report_customsql_pluginfile($course, $cm, $context, $filearea, $args, $ require_once(dirname(__FILE__) . '/locallib.php'); - if ($context->contextlevel != CONTEXT_SYSTEM) { return false; } diff --git a/locallib.php b/locallib.php index 5db0c02..845317d 100644 --- a/locallib.php +++ b/locallib.php @@ -180,6 +180,7 @@ function report_customsql_generate_csv($report, $timenow, $returnheaderwhenempty if (!empty($querylimit) && $count > $querylimit) { report_customsql_write_csv_row($handle, [REPORT_CUSTOMSQL_LIMIT_EXCEEDED_MARKER]); } + fclose($handle); }