Merge branch 'MDL-54941-master' of git://github.com/jleyva/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2016-08-03 00:29:45 +02:00
commit 8c7840df32
11 changed files with 46 additions and 160 deletions

View file

@ -728,23 +728,7 @@ class mod_wiki_external extends external_api {
throw new moodle_exception('cannotviewfiles', 'wiki');
} else if ($subwiki->id != -1) {
// The subwiki exists, let's get the files.
$fs = get_file_storage();
if ($files = $fs->get_area_files($context->id, 'mod_wiki', 'attachments', $subwiki->id, 'filename', false)) {
foreach ($files as $file) {
$filename = $file->get_filename();
$fileurl = moodle_url::make_webservice_pluginfile_url(
$context->id, 'mod_wiki', 'attachments', $subwiki->id, '/', $filename);
$returnedfiles[] = array(
'filename' => $filename,
'mimetype' => $file->get_mimetype(),
'fileurl' => $fileurl->out(false),
'filepath' => $file->get_filepath(),
'filesize' => $file->get_filesize(),
'timemodified' => $file->get_timemodified()
);
}
}
$returnedfiles = external_util::get_area_files($context->id, 'mod_wiki', 'attachments', $subwiki->id);
}
$result = array();
@ -763,18 +747,7 @@ class mod_wiki_external extends external_api {
return new external_single_structure(
array(
'files' => new external_multiple_structure(
new external_single_structure(
array(
'filename' => new external_value(PARAM_FILE, 'File name.'),
'filepath' => new external_value(PARAM_PATH, 'File path.'),
'filesize' => new external_value(PARAM_INT, 'File size.'),
'fileurl' => new external_value(PARAM_URL, 'Downloadable file url.'),
'timemodified' => new external_value(PARAM_INT, 'Time modified.'),
'mimetype' => new external_value(PARAM_RAW, 'File mime type.'),
), 'Files'
)
),
'files' => new external_files('Files'),
'warnings' => new external_warnings(),
)
);