mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-68199 setup: Fix invalid parameters to make_request_directory()
Added parameter type hint to make_request_directory() Removed invalid parameters from calls to make_request_directory() Removing these parameters should have no effect on behaviour.
This commit is contained in:
parent
16a5169a43
commit
e7f51a3857
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user