mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'dev_MDL-33513_files_source' of git://github.com/danpoltawski/moodle
This commit is contained in:
commit
cd925ac79b
13 changed files with 180 additions and 32 deletions
|
@ -265,6 +265,11 @@ switch ($action) {
|
|||
$event['existingfile']->filename = $saveas_filename;
|
||||
$event['existingfile']->url = moodle_url::make_draftfile_url($itemid, $saveas_path, $saveas_filename)->out();;
|
||||
} else {
|
||||
|
||||
// {@link repository::build_source_field()}
|
||||
$sourcefield = $repo->get_file_source_info($source);
|
||||
$record->source = $repo::build_source_field($sourcefield);
|
||||
|
||||
$storedfile = $fs->create_file_from_reference($record, $repo_id, $reference);
|
||||
$event = array(
|
||||
'url'=>moodle_url::make_draftfile_url($storedfile->get_itemid(), $storedfile->get_filepath(), $storedfile->get_filename())->out(),
|
||||
|
@ -302,14 +307,9 @@ switch ($action) {
|
|||
throw new file_exception('maxbytes');
|
||||
}
|
||||
|
||||
// {@link file_restore_source_field_from_draft_file()}
|
||||
$sourcefield = '';
|
||||
if (!empty($downloadedfile['url'])) {
|
||||
$source = new stdClass;
|
||||
$source->source = $downloadedfile['url'];
|
||||
$sourcefield = serialize($source);
|
||||
}
|
||||
$record->source = $sourcefield;
|
||||
// {@link repository::build_source_field()}
|
||||
$sourcefield = $repo->get_file_source_info($source);
|
||||
$record->source = $repo::build_source_field($sourcefield);
|
||||
|
||||
$info = repository::move_to_filepool($downloadedfile['path'], $record);
|
||||
if (empty($info)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue