| Línea 74... |
Línea 74... |
| 74 |
* @param int $itemid optional the ID for this item within the file area
|
74 |
* @param int $itemid optional the ID for this item within the file area
|
| 75 |
* @param string $license optional the license to use for this file
|
75 |
* @param string $license optional the license to use for this file
|
| 76 |
* @param string $author optional the name of the author of this file
|
76 |
* @param string $author optional the name of the author of this file
|
| 77 |
* @param bool $overwriteexisting optional user has asked to overwrite the existing file
|
77 |
* @param bool $overwriteexisting optional user has asked to overwrite the existing file
|
| 78 |
* @param int $areamaxbytes maximum size of the file area.
|
78 |
* @param int $areamaxbytes maximum size of the file area.
|
| 79 |
* @return object containing details of the file uploaded
|
79 |
* @return array containing details of the file uploaded
|
| 80 |
*/
|
80 |
*/
|
| 81 |
public function process_upload($saveasfilename, $maxbytes, $types = '*', $savepath = '/', $itemid = 0,
|
81 |
public function process_upload($saveasfilename, $maxbytes, $types = '*', $savepath = '/', $itemid = 0,
|
| 82 |
$license = null, $author = '', $overwriteexisting = false, $areamaxbytes = FILE_AREA_MAX_BYTES_UNLIMITED) {
|
82 |
$license = null, $author = '', $overwriteexisting = false, $areamaxbytes = FILE_AREA_MAX_BYTES_UNLIMITED) {
|
| 83 |
global $USER, $CFG;
|
83 |
global $USER, $CFG;
|
| Línea 143... |
Línea 143... |
| 143 |
default:
|
143 |
default:
|
| 144 |
throw new moodle_exception('nofile');
|
144 |
throw new moodle_exception('nofile');
|
| 145 |
}
|
145 |
}
|
| 146 |
}
|
146 |
}
|
| Línea -... |
Línea 147... |
| - |
|
147 |
|
| 147 |
|
148 |
$avscanstarttime = microtime(true);
|
| - |
|
149 |
\core\antivirus\manager::scan_file($_FILES[$elname]['tmp_name'], $_FILES[$elname]['name'], true);
|
| Línea 148... |
Línea 150... |
| 148 |
\core\antivirus\manager::scan_file($_FILES[$elname]['tmp_name'], $_FILES[$elname]['name'], true);
|
150 |
$avscantime = microtime(true) - $avscanstarttime;
|
| 149 |
|
151 |
|
| 150 |
// {@link repository::build_source_field()}
|
152 |
// {@link repository::build_source_field()}
|
| Línea 249... |
Línea 251... |
| 249 |
'itemid' => $record->itemid,
|
251 |
'itemid' => $record->itemid,
|
| 250 |
'filename' => $record->filename,
|
252 |
'filename' => $record->filename,
|
| 251 |
'filesize' => $filesize,
|
253 |
'filesize' => $filesize,
|
| 252 |
'filepath' => $record->filepath,
|
254 |
'filepath' => $record->filepath,
|
| 253 |
'contenthash' => $storedfile->get_contenthash(),
|
255 |
'contenthash' => $storedfile->get_contenthash(),
|
| - |
|
256 |
'avscantime' => $avscantime,
|
| 254 |
],
|
257 |
],
|
| 255 |
]);
|
258 |
]);
|
| 256 |
$logevent->trigger();
|
259 |
$logevent->trigger();
|
| Línea 257... |
Línea 260... |
| 257 |
|
260 |
|