adding getDirectDownload() to Wrapper
This commit is contained in:
parent
5b00bc1d6e
commit
81243b0f5d
2 changed files with 14 additions and 2 deletions
|
@ -39,7 +39,7 @@ class OC_Connector_Sabre_FilesPlugin extends \Sabre\DAV\ServerPlugin
|
||||||
$server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}id';
|
$server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}id';
|
||||||
$server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}permissions';
|
$server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}permissions';
|
||||||
$server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}size';
|
$server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}size';
|
||||||
$server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}dDU';
|
$server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}downloadURL';
|
||||||
|
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
$this->server->subscribeEvent('beforeGetProperties', array($this, 'beforeGetProperties'));
|
$this->server->subscribeEvent('beforeGetProperties', array($this, 'beforeGetProperties'));
|
||||||
|
@ -85,7 +85,7 @@ class OC_Connector_Sabre_FilesPlugin extends \Sabre\DAV\ServerPlugin
|
||||||
/** @var $node OC_Connector_Sabre_File */
|
/** @var $node OC_Connector_Sabre_File */
|
||||||
$directDownloadUrl = $node->getDirectDownload();
|
$directDownloadUrl = $node->getDirectDownload();
|
||||||
if (isset($directDownloadUrl['url'])) {
|
if (isset($directDownloadUrl['url'])) {
|
||||||
$directDownloadUrlPropertyName = '{' . self::NS_OWNCLOUD . '}dDU';
|
$directDownloadUrlPropertyName = '{' . self::NS_OWNCLOUD . '}downloadURL';
|
||||||
$returnedProperties[200][$directDownloadUrlPropertyName] = $directDownloadUrl['url'];
|
$returnedProperties[200][$directDownloadUrlPropertyName] = $directDownloadUrl['url'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,4 +465,16 @@ class Wrapper implements \OC\Files\Storage\Storage {
|
||||||
public function __call($method, $args) {
|
public function __call($method, $args) {
|
||||||
return call_user_func_array(array($this->storage, $method), $args);
|
return call_user_func_array(array($this->storage, $method), $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A custom storage implementation can return an url for direct download of a give file.
|
||||||
|
*
|
||||||
|
* For now the returned array can hold the parameter url - in future more attributes might follow.
|
||||||
|
*
|
||||||
|
* @param string $path
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getDirectDownload($path) {
|
||||||
|
return $this->storage->getDirectDownload($path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue