Merge branch 'MDL-36538_webdav_memory' of git://github.com/davosmith/moodle

This commit is contained in:
Dan Poltawski 2012-12-10 13:06:37 +08:00
commit 8df07e5086
2 changed files with 63 additions and 45 deletions

View file

@ -71,17 +71,13 @@ class repository_webdav extends repository {
return true;
}
public function get_file($url, $title = '') {
global $CFG;
$url = urldecode($url);
$path = $this->prepare_file($title);
$buffer = '';
if (!$this->dav->open()) {
return false;
}
$webdavpath = rtrim('/'.ltrim($this->options['webdav_path'], '/ '), '/ '); // without slash in the end
$this->dav->get($webdavpath. $url, $buffer);
$fp = fopen($path, 'wb');
fwrite($fp, $buffer);
$this->dav->get_file($webdavpath. $url, $path);
return array('path'=>$path);
}
public function global_search() {