diff --git a/analytics/classes/model_config.php b/analytics/classes/model_config.php index 75b31f1128b..67218507d9d 100644 --- a/analytics/classes/model_config.php +++ b/analytics/classes/model_config.php @@ -77,7 +77,7 @@ class model_config { // Model config in JSON. $modeldata = $this->export_model_data(); - $exporttmpdir = make_request_directory('analyticsexport'); + $exporttmpdir = make_request_directory(); $jsonfilepath = $exporttmpdir . DIRECTORY_SEPARATOR . 'model-config.json'; if (!file_put_contents($jsonfilepath, json_encode($modeldata))) { print_error('errornoexportconfig', 'analytics'); @@ -256,7 +256,7 @@ class model_config { */ public function extract_import_contents(string $zipfilepath) : array { - $importtempdir = make_request_directory('analyticsimport' . microtime(false)); + $importtempdir = make_request_directory(); $zip = new \zip_packer(); $filelist = $zip->extract_to_pathname($zipfilepath, $importtempdir); diff --git a/lib/mlbackend/python/classes/processor.php b/lib/mlbackend/python/classes/processor.php index 310c9813615..2c01133fbf4 100644 --- a/lib/mlbackend/python/classes/processor.php +++ b/lib/mlbackend/python/classes/processor.php @@ -276,7 +276,6 @@ class processor implements \core_analytics\classifier, \core_analytics\regresso throw new \moodle_exception('errorpredictwrongformat', 'analytics', '', json_last_error_msg()); } - if ($resultobj->status != 0) { $resultobj = $this->format_error_info($resultobj); } @@ -337,7 +336,7 @@ class processor implements \core_analytics\classifier, \core_analytics\regresso // We need an extra request to get the resources generated during the evaluation process. // Directory to temporarly store the evaluation log zip returned by the server. - $evaluationtmpdir = make_request_directory('mlbackend_python_evaluationlog'); + $evaluationtmpdir = make_request_directory(); $evaluationzippath = $evaluationtmpdir . DIRECTORY_SEPARATOR . 'evaluationlog.zip'; $requestparams = ['uniqueid' => $uniqueid, 'dirhash' => $this->hash_dir($outputdir), @@ -377,7 +376,7 @@ class processor implements \core_analytics\classifier, \core_analytics\regresso */ public function export(string $uniqueid, string $modeldir) : string { - $exporttmpdir = make_request_directory('mlbackend_python_export'); + $exporttmpdir = make_request_directory(); if (!$this->useserver) { // Use the local file system. @@ -717,7 +716,7 @@ class processor implements \core_analytics\classifier, \core_analytics\regresso */ private function zip_dir(string $dir) { - $ziptmpdir = make_request_directory('mlbackend_python'); + $ziptmpdir = make_request_directory(); $ziptmpfile = $ziptmpdir . DIRECTORY_SEPARATOR . 'mlbackend.zip'; $files = get_directory_list($dir); diff --git a/lib/setuplib.php b/lib/setuplib.php index 040d589965c..5fa082b9968 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -1706,7 +1706,7 @@ function get_request_storage_directory($exceptiononerror = true, bool $forcecrea * @param bool $forcecreate Force creation of a new parent directory * @return string The full path to directory if successful, false if not; may throw exception */ -function make_request_directory($exceptiononerror = true, bool $forcecreate = false) { +function make_request_directory(bool $exceptiononerror = true, bool $forcecreate = false) { $basedir = get_request_storage_directory($exceptiononerror, $forcecreate); return make_unique_writable_directory($basedir, $exceptiononerror); }