diff options
author | Clark Tomlinson <fallen013@gmail.com> | 2014-09-03 09:07:23 -0400 |
---|---|---|
committer | Clark Tomlinson <fallen013@gmail.com> | 2014-09-03 09:07:23 -0400 |
commit | 0400f7845c46dabc2c87913a8a047c11e39b3323 (patch) | |
tree | d2a54630b13c3c7aa23b0a3cfdd6759bc9f8c43a | |
parent | 6cdb1d89ae2d2c23e326da2a719ee88d495dd05e (diff) | |
parent | 647120fb36aaedf87036b47fb1fb354a14acb677 (diff) | |
download | nextcloud-server-0400f7845c46dabc2c87913a8a047c11e39b3323.tar.gz nextcloud-server-0400f7845c46dabc2c87913a8a047c11e39b3323.zip |
Merge pull request #10723 from owncloud/webdav-folder-size
adding new webdav property containing the folder size
-rw-r--r-- | lib/private/connector/sabre/directory.php | 9 | ||||
-rw-r--r-- | lib/private/connector/sabre/filesplugin.php | 10 |
2 files changed, 17 insertions, 2 deletions
diff --git a/lib/private/connector/sabre/directory.php b/lib/private/connector/sabre/directory.php index 9904c3525c4..9cd7c553f0b 100644 --- a/lib/private/connector/sabre/directory.php +++ b/lib/private/connector/sabre/directory.php @@ -230,4 +230,13 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node return $props; } + /** + * Returns the size of the node, in bytes + * + * @return int + */ + public function getSize() { + return $this->info->getSize(); + } + } diff --git a/lib/private/connector/sabre/filesplugin.php b/lib/private/connector/sabre/filesplugin.php index 30d1b1a872c..7f369d0e2e1 100644 --- a/lib/private/connector/sabre/filesplugin.php +++ b/lib/private/connector/sabre/filesplugin.php @@ -38,6 +38,7 @@ class OC_Connector_Sabre_FilesPlugin extends \Sabre\DAV\ServerPlugin $server->xmlNamespaces[self::NS_OWNCLOUD] = 'oc'; $server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}id'; $server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}permissions'; + $server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}size'; $this->server = $server; $this->server->subscribeEvent('beforeGetProperties', array($this, 'beforeGetProperties')); @@ -74,12 +75,17 @@ class OC_Connector_Sabre_FilesPlugin extends \Sabre\DAV\ServerPlugin } $permissions = $node->getDavPermissions(); - if (!is_null($fileId)) { + if (!is_null($permissions)) { $returnedProperties[200][$permissionsPropertyName] = $permissions; } - } + if ($node instanceof OC_Connector_Sabre_Directory) { + $sizePropertyName = '{' . self::NS_OWNCLOUD . '}size'; + + /** @var $node OC_Connector_Sabre_Directory */ + $returnedProperties[200][$sizePropertyName] = $node->getSize(); + } } /** |