This commit is contained in:
ferran
2025-09-03 10:46:02 +02:00
2 changed files with 23 additions and 0 deletions
@@ -141,6 +141,8 @@ class dndupload_ajax_processor {
protected function handle_file_upload() {
global $CFG;
$this->load_repository();
// Add the file to a draft file area.
$draftitemid = file_get_unused_draft_itemid();
$maxbytes = get_user_max_upload_file_size($this->context, $CFG->maxbytes, $this->course->maxbytes);
@@ -332,6 +334,16 @@ class dndupload_ajax_processor {
echo json_encode($resp);
die();
}
/**
* Load the repository libraries.
*/
private function load_repository(): void {
global $CFG;
require_once("{$CFG->dirroot}/repository/lib.php");
}
}
// Alias this class to the old name.
@@ -295,6 +295,8 @@ class dndupload_handler {
public function get_js_data() {
global $CFG;
$this->load_repository();
$ret = new stdClass();
// Sort the types by priority.
@@ -334,6 +336,15 @@ class dndupload_handler {
}
return 0;
}
/**
* Load the repository libraries.
*/
private function load_repository(): void {
global $CFG;
require_once("{$CFG->dirroot}/repository/lib.php");
}
}
// Alias this class to the old name.