MDL-58128 googledocs: Support reference files.

Add options so the admin can control the types of files this repository can support (and the default).

Part of MDL-58220
This commit is contained in:
Damyon Wiese
2017-04-03 13:40:13 +08:00
parent 6c9cd495a2
commit 989e14fea0
10 changed files with 591 additions and 25 deletions
+28
View File
@@ -3458,6 +3458,34 @@ class curl {
return $this->request($url, $options);
}
/**
* HTTP PATCH method
*
* @param string $url
* @param array|string $params
* @param array $options
* @return bool
*/
public function patch($url, $params = '', $options = array()) {
$options['CURLOPT_CUSTOMREQUEST'] = 'PATCH';
if (is_array($params)) {
$this->_tmp_file_post_params = array();
foreach ($params as $key => $value) {
if ($value instanceof stored_file) {
$value->add_to_curl_request($this, $key);
} else {
$this->_tmp_file_post_params[$key] = $value;
}
}
$options['CURLOPT_POSTFIELDS'] = $this->_tmp_file_post_params;
unset($this->_tmp_file_post_params);
} else {
// $params is the raw post data
$options['CURLOPT_POSTFIELDS'] = $params;
}
return $this->request($url, $options);
}
/**
* HTTP POST method
*