mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +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
|
@ -188,6 +188,29 @@ class boxclient {
|
|||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get box.net file info
|
||||
*
|
||||
* @param string $fileid
|
||||
* @return string|null
|
||||
*/
|
||||
function get_file_info($fileid) {
|
||||
$this->_clearErrors();
|
||||
$params = array();
|
||||
$params['action'] = 'get_file_info';
|
||||
$params['file_id'] = $fileid;
|
||||
$params['auth_token'] = $this->auth_token;
|
||||
$params['api_key'] = $this->api_key;
|
||||
$http = new curl(array('debug'=>$this->debug, 'cache'=>true, 'module_cache'=>'repository'));
|
||||
$xml = $http->get($this->_box_api_url, $params);
|
||||
$o = simplexml_load_string(trim($xml));
|
||||
if ($o->status == 's_get_file_info') {
|
||||
return $o->info;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $sax
|
||||
* @param array $tree Passed by reference
|
||||
|
|
|
@ -770,6 +770,7 @@ function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
|
|||
$newhashes = array();
|
||||
foreach ($draftfiles as $file) {
|
||||
$newhash = $fs->get_pathname_hash($contextid, $component, $filearea, $itemid, $file->get_filepath(), $file->get_filename());
|
||||
file_restore_source_field_from_draft_file($file);
|
||||
$newhashes[$newhash] = $file;
|
||||
}
|
||||
$filecount = 0;
|
||||
|
@ -790,7 +791,6 @@ function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
|
|||
continue;
|
||||
}
|
||||
|
||||
file_restore_source_field_from_draft_file($newfile);
|
||||
// Replaced file content
|
||||
if ($oldfile->get_contenthash() != $newfile->get_contenthash()) {
|
||||
$oldfile->replace_content_with($newfile);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue